meteor-promise
Version:
ES6 Promise polyfill with Fiber support
21 lines (17 loc) • 564 B
JavaScript
exports.makeCompatible = function (Promise) {
var es6PromiseThen = Promise.prototype.then;
Promise.prototype.then = function (onResolved, onRejected) {
if (typeof Meteor === "object" &&
typeof Meteor.bindEnvironment === "function") {
return es6PromiseThen.call(
this,
onResolved && Meteor.bindEnvironment(onResolved, raise),
onRejected && Meteor.bindEnvironment(onRejected, raise)
);
}
return es6PromiseThen.call(this, onResolved, onRejected);
};
};
function raise(exception) {
throw exception;
}