diff --git a/example/web/README.md b/example/web/README.md index 50fbc0bb6..e903d263a 100644 --- a/example/web/README.md +++ b/example/web/README.md @@ -6,7 +6,7 @@ You need a Unix shell with `sed`, `tar` and `wget` utilities to run the provided ## Building tdweb NPM package -* Install the 2.0.6 [emsdk](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html), which is known to work. Do not use the system-provided `emscripten` package, because it contains a too old emsdk version. +* Install the 3.1.1 [emsdk](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html), which is known to work. Do not use the system-provided `emscripten` package, because it contains a too old emsdk version. * Install all `TDLib` build dependencies described in [Building](https://github.com/tdlib/td#building) and `sed`, `tar` and `wget` utilities. * Run `source ./emsdk_env.sh` from `emsdk` directory to set up the correct build environment. * On `macOS`, install the `coreutils` [Homebrew](https://brew.sh) package and replace `realpath` in scripts with `grealpath`: diff --git a/example/web/tdweb/src/worker.js b/example/web/tdweb/src/worker.js index 363a96e15..abc087c44 100644 --- a/example/web/tdweb/src/worker.js +++ b/example/web/tdweb/src/worker.js @@ -73,6 +73,7 @@ async function loadTdlibWasm(onFS, wasmUrl) { let module = createTdwebModule({ onRuntimeInitialized: () => { log.info('runtime intialized'); + onFS(module.FS); }, instantiateWasm: (imports, successCallback) => { log.info('start instantiateWasm', td_wasm, imports); @@ -85,7 +86,6 @@ async function loadTdlibWasm(onFS, wasmUrl) { }, ENVIROMENT: 'WORKER' }); - onFS(module.FS); // hack log.info('Wait module'); module = await module; log.info('Got module', module); @@ -103,6 +103,7 @@ async function loadTdlibAsmjs(onFS) { let module = createTdwebModule({ onRuntimeInitialized: () => { console.log('runtime intialized'); + onFS(module.FS); }, locateFile: name => { if (name === fromFile) { @@ -112,7 +113,6 @@ async function loadTdlibAsmjs(onFS) { }, ENVIROMENT: 'WORKER' }); - onFS(module.FS); // hack log.info('Wait module'); module = await module; log.info('Got module', module); @@ -614,7 +614,11 @@ class TdClient { this.TdModule = await loadTdlib(mode, this.onFS, options.wasmUrl); log.info('got TdModule'); this.td_functions = { - td_create: this.TdModule.cwrap('td_emscripten_create_client_id', 'number', []), + td_create: this.TdModule.cwrap( + 'td_emscripten_create_client_id', + 'number', + [] + ), td_send: this.TdModule.cwrap('td_emscripten_send', null, [ 'number', 'string'