-
-
Save rstudner/46a48a74694f3016dd8f04a7099ef4c8 to your computer and use it in GitHub Desktop.
ember-concurrency starter
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', | |
myTask: task(function * () { | |
let didConfirm = yield this.get('getConfirmation').perform("Are you sure?"); | |
if (didConfirm) { | |
alert("woot"); | |
} | |
}), | |
confirmation: null, | |
getConfirmation: task(function * (prompt) { | |
try { | |
let defer = Ember.RSVP.defer(); | |
this.set('confirmation', { | |
resolve: defer.resolve, | |
prompt | |
}); | |
return yield defer.promise; | |
} finally { | |
this.set('confirmation', null); | |
} | |
}) | |
}); |
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.10.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.6.0", | |
"ember-data": "2.6.1", | |
"ember-template-compiler": "2.6.0" | |
}, | |
"addons": { | |
"ember-concurrency": "latest" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment