aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-04 16:53:01 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-05 19:57:37 +0300
commit067c26982e4b374fbb51fa49d9930ddf0c8e00fd (patch)
treeea8b41f2b2d2f5f4d1fc3d6650c5ce5f96af851e
parent559033f0a6c2c8c298bd305065e475f0b385cd17 (diff)
setTimeout refactoring
-rw-r--r--ext/mixed/js/core.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index ca37a26a..4314926c 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -331,14 +331,15 @@ const yomichan = (() => {
if (timeout !== null) {
timeoutId = window.setTimeout(() => {
timeoutId = null;
- reject(new Error(`Listener timed out in ${timeout} ms`));
eventHandler.removeListener(runtimeMessageCallback);
+ reject(new Error(`Listener timed out in ${timeout} ms`));
}, timeout);
}
const cleanupResolve = (value) => {
if (timeoutId !== null) {
window.clearTimeout(timeoutId);
+ timeoutId = null;
}
eventHandler.removeListener(runtimeMessageCallback);
sendResponse();