Review the code below. I have called setQuestion()
within the successCallBack of db.transaction
but am encountering an error:
Uncaught TypeError: this.setQuestions is not a function
.
Can you spot any issues in my code?
game.module(
"game.scenes.scene"
)
.require(
"game.assets",
"game.entities.gameObject",
"game.entities.backgroundObject",
"game.entities.animeObject",
"game.entities.starObject",
"game.entities.buttonObject"
).body(function() {
game.SceneScene1 = game.Scene.extend({
loaded: function() {
this.get_difficulty_level();
},
setQuestions: function() {
//some code
},
get_difficulty_level: function(){
var app_id = this.app_id;
var user_id = this.user_id;
db.transaction(function (transaction)
{
transaction.executeSql('SELECT * FROM User_report where app_id="'+app_id+'" and user_id="'+user_id+'" order by id desc limit 1;', [],
function (transaction, result)
{
if (result.rows.length == 0)
{
difficulty_level=2;
}else{
difficulty_level = result.rows.item(0).difficulty;
console.log(result.rows.item(0));
}
});
},this.errorHandler,this.successDiffi);
},
successDiffi: function(){
this.setQuestions();
},
});
});