Skip to content

Instantly share code, notes, and snippets.

@zackthehuman
Created May 24, 2016 18:52
Show Gist options
  • Save zackthehuman/db09ac4bf2557fbe2076203ea3e27685 to your computer and use it in GitHub Desktop.
Save zackthehuman/db09ac4bf2557fbe2076203ea3e27685 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Helper.extend({
count: 0,
timer: undefined,
compute(params, hash) {
clearInterval(this.get('timer'));
setInterval(() => { this.recompute(); }, params[0] || 500);
this.set('count', this.get('count') + 1);
return this.get('count');
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{my-helper 500}}
{{my-helper 100}}
<br>
<br>
{
"version": "0.8.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment