From 1bf471713cf4746a0698ef6eae41b508810c78a5 Mon Sep 17 00:00:00 2001 From: isaurssaurav Date: Sun, 15 Oct 2023 17:17:37 +0200 Subject: [PATCH] fix: mutiple update fix --- src/main.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main.ts b/src/main.ts index 2b15e5c..171ef20 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,7 +11,6 @@ export type hotReloadExtensionOptions = { }; let IS_TRANSFORMED = false; -let IS_BUFFERING = false; const hotReloadExtension = (options: hotReloadExtensionOptions): Plugin => { const { log, backgroundPath } = options; @@ -52,20 +51,11 @@ const hotReloadExtension = (options: hotReloadExtensionOptions): Plugin => { return; } - await new Promise((res) => { - setTimeout(() => { - IS_BUFFERING = true; - res(1); - }, 500); - }); - - IS_BUFFERING = false; - - if (!IS_BUFFERING) { + // buffer time + setTimeout(() => { ws?.send(Message.FILE_CHANGE); - } - - if (log) chalkLogger.green('Extension Reloaded...'); + if (log) chalkLogger.green('Extension Reloaded...'); + }, 500); } }; };