Stub Promise.defer() to avoid the Bluebird deprecation warnings

We should indeed use `new Zotero.Promise`, but we don't need the
warnings for existing code.
This commit is contained in:
Dan Stillman 2018-08-16 18:20:34 -04:00
parent e736f07ebc
commit 0165f75f79

View file

@ -10,6 +10,15 @@ Promise.config({
cancellation: true
});
// Use our own stub to avoid the Bluebird deprecation warnings
Promise.defer = function() {
var deferred = {};
deferred.promise = new Promise(function(resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
return deferred;
}
// TEMP: Only turn on if debug logging enabled?
Promise.onPossiblyUnhandledRejection((e, promise) => {
if (e.name == 'ZoteroPromiseInterrupt' || e.handledRejection) {