From a253c468f60e3b1d3e5c19f31ce99134963ee8e9 Mon Sep 17 00:00:00 2001 From: Gerben Oolbekkink Date: Fri, 22 Jan 2021 20:52:56 +0100 Subject: [PATCH] Fix jakubkowalczyk-pl/jgallery#81, explicitely return null in Promise --- src/utils/cancellable-promise.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/cancellable-promise.ts b/src/utils/cancellable-promise.ts index 7004452..696a017 100644 --- a/src/utils/cancellable-promise.ts +++ b/src/utils/cancellable-promise.ts @@ -20,10 +20,10 @@ const cancellablePromise = (executor: Executor): CancellablePromise => const cancelListeners: Array<() => any> = []; let cancel: () => any; const onCancel = (listener: () => any) => cancelListeners.push(listener); - const promise: CancellablePromise = new Promise((resolve, reject) => { + const promise: CancellablePromise = new Promise((resolve, reject) => { executor(resolve, reject, onCancel); cancel = () => { - resolve(); + resolve(null); cancelListeners.forEach(fn => fn()); }; });