Closed guybedford closed 9 years ago
Hey @guybedford. There's no way yet, but we're planning to provide one.
In the meantime, would it work for you to write your own tiny wrapper module that does the following?
var unhandledRejection = require('when/lib/decorators/unhandledRejection');
module.exports = unhandledRejection(require('when/lib/Promise'));
If so, then that'd get you an ES6 compliant Promise
with the default unhandled rejection reports enabled, without overriding the global.
If that's not an option, let me know, and I'll bump up the priority on this.
Thanks @briancavalier for the quick response - yes that will work great. Note it is specifically for Node that this is needed - in the browser we do want the Promise global to be polyfilled.
In terms of implementing the shim without overriding the global, what would be really useful is setting global.Promise
only if it is not already set, and then perhaps providing a polyfill interface like global.when.Promise
that could also be relied on, although that may not even be necessary.
yes that will work great
Cool, thanks for confirming.
what would be really useful is setting global.Promise only if it is not already set
Yep, I totally agree. That's the route we'll go. See #442 for a bit more on why we originally decided to forcibly overwrite global Promise.
Is it cool w/you if we close this and track progress in #442?
Sure, thanks for your help!
Is it possible to require the es6-shim in a way that doesn't override the global Promise?