Last active
October 28, 2015 16:21
-
-
Save frank06/ca6ca8b76bf135e3af6c to your computer and use it in GitHub Desktop.
auctions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Auction Service', | |
bidService: Ember.inject.service() | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Service.extend({ | |
auctions: [ | |
{ id: 1, price: 19, title: "T-shirt"}, | |
{ id: 2, price: 226, title: "iPhone 5"}, | |
{ id: 3, price: 170, title: "Pony toy"}, | |
{ id: 4, price: 5, title: "Methylene blue"} | |
], | |
getHighestBidForAuction(id) { | |
}, | |
_multiplier: 1.03, | |
bidSimulator: function() { | |
setInterval(() => { | |
console.log('in interval') | |
this.get('auctions').forEach(a => { | |
Ember.set(a, 'price', (a.price * this._multiplier).toFixed(2)); | |
}) | |
}, 3000) | |
}.on('init') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
var Router = Ember.Router.extend({ | |
location: config.locationType | |
}); | |
Router.map(function() { | |
this.route('auction', { path: ':id'}); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.4.14", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment