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:
parent
e736f07ebc
commit
0165f75f79
1 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,15 @@ Promise.config({
|
||||||
cancellation: true
|
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?
|
// TEMP: Only turn on if debug logging enabled?
|
||||||
Promise.onPossiblyUnhandledRejection((e, promise) => {
|
Promise.onPossiblyUnhandledRejection((e, promise) => {
|
||||||
if (e.name == 'ZoteroPromiseInterrupt' || e.handledRejection) {
|
if (e.name == 'ZoteroPromiseInterrupt' || e.handledRejection) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue