summaryrefslogtreecommitdiff
path: root/ext/mixed
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-06-28 11:23:51 -0400
committerGitHub <noreply@github.com>2020-06-28 11:23:51 -0400
commit51981f0c4e11548e138f8b4e57ffd8b96bdee4fe (patch)
tree4cf296565bfdf6e1dbdf56d8fe69d09072a6a3e9 /ext/mixed
parent0a6c08d0f53090a4ad48663bc5846ddae5723d52 (diff)
Add deferPromise function (#626)
Diffstat (limited to 'ext/mixed')
-rw-r--r--ext/mixed/js/core.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index bf877e72..0fe5ea20 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -203,6 +203,16 @@ function promiseTimeout(delay, resolveValue) {
return promise;
}
+function deferPromise() {
+ let resolve;
+ let reject;
+ const promise = new Promise((resolve2, reject2) => {
+ resolve = resolve2;
+ reject = reject2;
+ });
+ return {promise, resolve, reject};
+}
+
/*
* Common events