Last active
March 22, 2017 18:40
-
-
Save akatov/128e46ea828861eb512e1b55ed403776 to your computer and use it in GitHub Desktop.
Promise Array Experiments
This file contains 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 DS from 'ember-data'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
actions: { | |
fire() { | |
window.resolve('hai'); | |
} | |
} | |
}); | |
window.promise = new Ember.RSVP.Promise((resolve) => { | |
window.resolve = resolve; | |
// will be resolved manually | |
}); | |
window.promises = Ember.RSVP.all([window.promise]); | |
window.promiseArray = DS.PromiseArray.create({ promise: window.promises }); | |
window.logPromiseArray = function() { | |
console.log('promiseArray ', window.promiseArray) | |
console.log('promiseArray []', window.promiseArray.toArray()) | |
} | |
logPromiseArray() | |
window.promise.then((x) => { | |
console.log('resolved with', x); | |
logPromiseArray(); | |
}); | |
window.promiseArray.then((x) => { | |
console.log('promiseArray resolved with', x); | |
logPromiseArray(); | |
}) |
This file contains 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.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" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment