Javascript 新发布的余烬数据破坏了余烬cli?
您好,我是一个余烬noob,当我升级到最新的余烬数据时,我收到以下警告: 更新:我有两个版本的应用程序,一个是不带ember cli的,另一个是带ember cli的。两个应用程序完全相同。它们都将这些消息记录到控制台: 不推荐使用:不推荐使用Javascript 新发布的余烬数据破坏了余烬cli?,javascript,ember.js,ember-data,firebase,ember-cli,Javascript,Ember.js,Ember Data,Firebase,Ember Cli,您好,我是一个余烬noob,当我升级到最新的余烬数据时,我收到以下警告: 更新:我有两个版本的应用程序,一个是不带ember cli的,另一个是带ember cli的。两个应用程序完全相同。它们都将这些消息记录到控制台: 不推荐使用:不推荐使用snapshot.constructor,请改用snapshot.type 不推荐使用:不推荐使用DS.Snapshot.get()。改为使用.attr()、.belongsTo()或.hasMany() 第一个会弹出两次,第二个会在我单击警报后立即弹出一
snapshot.constructor
,请改用snapshot.type
不推荐使用:不推荐使用DS.Snapshot.get()。改为使用.attr()、.belongsTo()或.hasMany()
第一个会弹出两次,第二个会在我单击警报后立即弹出一次。下面是代码:
不同之处在于,不使用ember cli构建的应用程序可以正常工作
在我看来,这一定是ember cli的问题
import Ember from 'ember';
export default Ember.Controller.extend({
sortProperties:["time"],
sortAscending:true,
start:new Date(),
count:0,
incorrect:0,
startReview:true,
showHighScores:false,
actions:{
startReview:function(){
this.set('startReview',false);
this.set("showHighScores",false);
this.start = new Date();
this.count = 0;
this.incorrect = 0;
console.log(this.count);
},
showHighScores:function(){
this.toggleProperty("showHighScores");
},
checkCorrectness:function(word){
var textArray = this.get("model.text").split(" ");
var length = textArray.length;
if(word === textArray[this.count]){
console.log("correct");
this.count++;
console.log(this.count);
}else{
console.log("Incorrect");
this.incorrect++;
}
if(length === this.count){
var finish = new Date();
var time = finish-this.start;
var accuracy = (this.count/(this.count+this.incorrect)*100);
**alert("You took "+time/1000+" seconds! With "+accuracy+"% accuracy!");**
单击此警报后,将立即显示弃用警告
我认为下面代码中的设置和获取一定是违规者,但我
不知道如何将其更改为comlply,并将最新更新更改为
余烬数据
这里有一个关于最新版本余烬数据发布的博客帖子链接看不到整个过程会让你很难看清问题所在 如果有什么帮助的话,我也遇到了类似的问题,因为我创建了自定义序列化程序(您为ember data 15 beta链接的注释特别指出,更改的范围是序列化程序),在我过度使用的序列化程序代码中,我正在执行record.get('someproperty'),而不是更新的record.attr('someproperty')他们希望你现在就做 您是在使用自己的适配器/序列化程序,还是在使用其他人组装的东西?你在那里使用的任何东西都有可能没有被正确更新 更新: 根据评论,您正在使用firebase适配器,该适配器显然与ember数据0.1.15b存在已知问题。看 基本上,他们正在使用:
json[payloadKey]=Ember.A(record.get(key)).mappy('id');
在其序列化函数中,它现在应为:
json[payloadKey]=Ember.A(record.attr(key)).mappy('id');
那么你的问题是什么?嗨,欢迎来到StackOverflow。这是一个问答论坛,很难在这里找到具体的问题。这读起来更像是一个bug报告。我正在使用firebase适配器这是他们的序列化程序中的一个bug(或者至少是一个bug,如果你想运行ember data b15)。他们的serializeHasMany中有一行代码:json[payloadKey]=Ember.a(record.get(key)).mapBy('id');问题是在b15中不能这样做,我相信应该是json[payloadKey]=Ember.A(record.attr(key)).mapBy('id');因为它显然已经和他们一起提出了。你可以按照我所说的,把它叉起来,然后改变它,看看这是否有效,直到他们发布一个更持久的补丁。
this.saveResult(time);
this.set('startReview',true);
}
},
},
randomizer:function(){
this.set("randomArray",this.get("model.text").split(" ").randomize());
}.observes("startReview"),
saveResult:function(timeTaken){
var date = new Date(),
userName = "TimTheGreat";
var score = this.store.createRecord('score',{
userName:userName,
date:date,
time:timeTaken,
verse:this.get('model'),
});
var controller = this;
var scores = controller.get("model.scores");
score.save().then(function(score){
scores.addObject(score).then(function(){
controller.get("model").save();
});
});
}
});