Skip to content

Commit 575e43a

Browse files
committed
fix(loadModule): update init logic
1 parent a0f2c22 commit 575e43a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { hunspellLoader } from './hunspellLoader';
33
import { isWasmEnabled } from './util/isWasmEnabled';
44

55
export const loadModule = async (): Promise<spellCheckerFactory> => {
6+
const modulePath = `./lib/${isWasmEnabled() ? 'wasm' : 'asm'}/hunspell`;
67
//tslint:disable-next-line:no-require-imports
7-
const moduleLoader = isWasmEnabled() ? require('./lib/wasm/hunspell') : null;
8+
const moduleLoader = require(modulePath);
89
const asmModule = moduleLoader();
910

10-
//TODO: need to move into preprocessor
11-
const initialize = new Promise((resolve) => asmModule.onRuntimeInitialized = () => resolve());
12-
await initialize;
11+
await asmModule.initializeRuntime();
1312

1413
return hunspellLoader(asmModule);
1514
};

0 commit comments

Comments
 (0)