aboutsummaryrefslogtreecommitdiffhomepage
path: root/example/web
diff options
context:
space:
mode:
authorArseny Smirnov <arseny30@gmail.com>2022-01-25 15:59:50 +0300
committerArseny Smirnov <arseny30@gmail.com>2022-01-25 16:00:21 +0300
commitc485b77b5e5133a9dee2cae884e03e2de98bcbda (patch)
tree42ccaa9603fe0b2c25c5014a0f92de183fd6c8ae /example/web
parentfa8feefed70d64271945e9d5fd010b957d93c8cd (diff)
support newest emsdk version
Diffstat (limited to 'example/web')
-rw-r--r--example/web/README.md2
-rw-r--r--example/web/tdweb/src/worker.js10
2 files changed, 8 insertions, 4 deletions
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'