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
var p0 = Promise.cast(null); | |
var p1 = p0.then(() => remotePromise); | |
var p2 = p1.invoke("foo"); | |
line 2 calls remotePromise's .then method, like so: | |
remotePromise.then(v => { set p1's [[Value]] to v }, r => { set p1's [[Reason]] to r }) | |
it ALSO stores remotePromise in [[Following]] | |
Once remotePromise settles, i.e. once one of the two above callbacks gets called, | |
[[Following]] gets cleared. |
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
// This module uses AP2 as its starting point: | |
// https://github.com/domenic/promises-unwrapping | |
var hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty); | |
function mixin(a, b) { | |
Object.keys(b).forEach(function(key) { | |
a[key] = b[key]; | |
}); | |
return a; |
NewerOlder