Skip to content

Commit

Permalink
fix: Fixed webpack events error
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Mar 13, 2023
1 parent af1f7c2 commit 2b1da73
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/webpack/index.ts
Expand Up @@ -31,11 +31,19 @@ export let isInjected = false;
export let isReady = false;

export function onInjected(listener: () => void): void {
internalEv.on('webpack.injected', async () => listener());
internalEv.on('webpack.injected', async () =>
Promise.resolve()
.then(listener)
.catch(() => null)
);
}

export function onReady(listener: () => void): void {
internalEv.on('webpack.ready', async () => listener());
internalEv.on('webpack.ready', () =>
Promise.resolve()
.then(listener)
.catch(() => null)
);
}

export type SearchModuleCondition = (module: any, moduleId: string) => boolean;
Expand Down

0 comments on commit 2b1da73

Please sign in to comment.