Last active
November 6, 2015 07:14
-
-
Save gregtap/749552635bd1cd86db1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| export default Component.extend({ | |
| tagName: 'time', | |
| ticker: inject.service('ticker'), | |
| timeago: Ember.computed('ticker.tick', function() { | |
| return utils.timeAgoString(this.get('date')); | |
| }), | |
| }); | |
This file contains hidden or 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
| Issue: | |
| The dom seems to get updated every second even if the content of timeago did not change. | |
| http://public.coulix.s3.amazonaws.com/blink_.gif |
This file contains hidden or 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
| export function initialize(application) { | |
| application.inject('component', 'ticker', 'service:ticker'); | |
| } | |
| export default { | |
| name: 'application', | |
| initialize: initialize, | |
| }; |
This file contains hidden or 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'; | |
| const { Service, run } = Ember; | |
| export default Service.extend({ | |
| init: function() { | |
| run.later(this, this.giveMeATick, 1000); | |
| }, | |
| giveMeATick: function() { | |
| this.set('tick', true); | |
| console.log('I SAID TICK!'); | |
| run.later(this, this.giveMeATick, 1000); | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment