Skip to content

Instantly share code, notes, and snippets.

@akatov
Last active July 15, 2017 00:47
Show Gist options
  • Save akatov/2aaa2dd10e0200e0e5e43a52c5f04b54 to your computer and use it in GitHub Desktop.
Save akatov/2aaa2dd10e0200e0e5e43a52c5f04b54 to your computer and use it in GitHub Desktop.
ember-co twiddle test
import Ember from 'ember';
import DS from 'ember-data';
import co, { wrap } from 'ember-co';
export default Ember.Controller.extend({
_bla: wrap(function*(a) {
return yield Ember.RSVP.resolve(a + a);
}),
app: Ember.computed(function() {
let self = this;
return DS.PromiseObject.create({
promise: co(function*() {
let name = yield self._bla('Application');
return { name };
})
});
}),
});
<h1>Welcome to {{app.name}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{
"version": "0.11.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.11.0",
"ember-data": "2.11.0",
"ember-template-compiler": "2.11.0",
"ember-testing": "2.11.0",
"babel-polyfill":"https://cdn.rawgit.com/nicksrandall/babel-polyfill/master/browser-polyfill.js"
},
"addons": {
"ember-co": "1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment