以下のように Parse.Object をサブクラス化しました。
var CFSScoreData = Parse.Object.extend("CFSScoreData",
{
initialize:function () {
this.playerName = "RACCOON";
this.playTimeInSec = 0;
this.rank = 0;
this.updateScore();
},
updateScore:function () {
this.set("playerName", this.playerName);
this.set("playTimeInSec", this.playTimeInSec);
this.set("rank", this.rank);
},
saveScore:function () {
this.updateScore();
this.save(null, {
success: function() {
alert("saveSuccess");
},
error: function(error) {
alert("saveError");
}
});
},
}
);
これはうまくいきました。
しかし、保存後にオブジェクトのIDを取得したいので、試しました:
saveScore:function () {
this.updateScore();
this.save(null, {
success: function(this) {
alert("saveSuccess" + this.id);
},
error: function(error) {
alert("saveError");
}
});
},
しかし、うまくいきませんでした...
アドバイスをいただければ幸いです、ありがとう:)