I am still rather new to Ember and I am stuck on an idea that I would like to get done. I could do this in JQuery/Javascript, but I want to use some of the Ember features to get this properly done.
I am trying to create a live stock ticker, that would simply auto-refresh every few seconds with a value +50, -100, +1512, -25, etc.
I am mostly just stuck on how to get a variable that auto-refreshes per the allotted amount of time. Should I create a custom component?
Any tips would be appreciated, thanks
UPDATE:
<span class="pull-right">Ember Stock Market: {{emberStock}} </span>
App.ApplicationController = Ember.Controller.extend({
emberStock: '0'
});
App.ApplicationRoute = Ember.Route.extend({
setupController: function(controller){
this.stockTicker(controller);
},
stockTicker: function(controller){
var self = this;
var price = Math.floor(Math.random() * 50) - 1;
controller.set('emberStock', price);
Em.run.later(function(){
self.stockTicker(controller);
}, 1000);
}
});