Last active
April 4, 2017 09:22
-
-
Save tzellman/acfaa7b515e147abd35834e21fa099fd to your computer and use it in GitHub Desktop.
EC orchestration
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'; | |
import {task, timeout} from 'ember-concurrency'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
inputValue: 0, | |
numProcessed: 0, | |
onValueChange: Ember.observer("inputValue", function(){ | |
this.get("processSoon").perform(this.get("inputValue")); | |
}), | |
longRunningTask: task(function*(value){ | |
yield timeout(2000); //simulate a long operation | |
this.incrementProperty("numProcessed", 1); | |
return value; | |
}).drop(), | |
processSoon: task(function*(value){ | |
yield timeout(500); //debounce | |
yield this.get("longRunningTask").perform(value); | |
}).restartable() | |
}); |
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
{ | |
"version": "0.12.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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1", | |
"ember-concurrency": "0.7.19", | |
"ember-math-helpers": "2.0.5", | |
"ember-truth-helpers": "1.3.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment