From 51981f0c4e11548e138f8b4e57ffd8b96bdee4fe Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 28 Jun 2020 11:23:51 -0400 Subject: Add deferPromise function (#626) --- ext/mixed/js/core.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ext') 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 -- cgit v1.2.3