Last active
March 29, 2016 10:58
-
-
Save mickvangelderen/8463e8483667807250e6 to your computer and use it in GitHub Desktop.
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
function Future$fork(rej, res){ | |
check$fork(this, rej, res); | |
let immediate = false; | |
let clear = function Future$fork$immediateClear() { | |
immediate = true | |
}; | |
const _this = this; | |
function maybeClear() { | |
if (_this._b && clear) { | |
clear() | |
clear = null | |
} | |
} | |
clear = fork(this, function Future$fork$rej(x){ | |
maybeClear(); | |
rej(x); | |
}, function Future$fork$res(x){ | |
maybeClear(); | |
res(x); | |
}); | |
if (immediate) maybeClear(); | |
return clear; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment