Skip to content

Commit

Permalink
fix: mutiple update fix
Browse files Browse the repository at this point in the history
  • Loading branch information
isaurssaurav committed Oct 15, 2023
1 parent 281baaf commit 1bf4717
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export type hotReloadExtensionOptions = {
};

let IS_TRANSFORMED = false;
let IS_BUFFERING = false;

const hotReloadExtension = (options: hotReloadExtensionOptions): Plugin => {
const { log, backgroundPath } = options;
Expand Down Expand Up @@ -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);
}
};
};
Expand Down

0 comments on commit 1bf4717

Please sign in to comment.