App=Ember.Application.create();// 使用するFirebaseを指定App.IndexRoute=Ember.Route.extend({model:function(){returnEmberFire.Array.create({ref:newFirebase("https://ember-chat.firebaseio-demo.com/")});}});// データを保存App.IndexController=Ember.ArrayController.extend({msg:"",from:"Guest"+Math.floor(Math.random()*100),actions:{sendMessage:function(){this.pushObject({from:this.get("from"),msg:this.get("msg")});this.set("msg",null);}}});// HTMLを見やすくApp.ScrollingDivComponent=Ember.Component.extend({scheduleScrollIntoView:function(){// Only run once per tick, once rendering has completed;// avoid flood of scrolls when many updates happen at onceEmber.run.scheduleOnce("afterRender",this,"scrollIntoView");}.observes("update-when.@each"),scrollIntoView:function(){this.$().scrollTop(this.$().prop("scrollHeight"));}});