Add deferPromise function (#626)

This commit is contained in:
toasted-nutbread 2020-06-28 11:23:51 -04:00 committed by GitHub
parent 0a6c08d0f5
commit 51981f0c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -99,6 +99,7 @@
"getSetIntersection": "readonly", "getSetIntersection": "readonly",
"getSetDifference": "readonly", "getSetDifference": "readonly",
"escapeRegExp": "readonly", "escapeRegExp": "readonly",
"deferPromise": "readonly",
"EventDispatcher": "readonly", "EventDispatcher": "readonly",
"EventListenerCollection": "readonly", "EventListenerCollection": "readonly",
"EXTENSION_IS_BROWSER_EDGE": "readonly" "EXTENSION_IS_BROWSER_EDGE": "readonly"

View File

@ -203,6 +203,16 @@ function promiseTimeout(delay, resolveValue) {
return promise; return promise;
} }
function deferPromise() {
let resolve;
let reject;
const promise = new Promise((resolve2, reject2) => {
resolve = resolve2;
reject = reject2;
});
return {promise, resolve, reject};
}
/* /*
* Common events * Common events