diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-06-06 09:13:54 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-06-06 09:13:54 +0200 |
| commit | ab0db69a7b11ba1a9dc52d50c94e9e321b70ebf0 (patch) | |
| tree | 76be6a8b1596ea1e74dbf7085b85214c2c83e69a /06_storage/init_idbfs.js | |
| parent | 961c3470d7e9bdf5efbe0509f586be75d7052d8b (diff) | |
| download | emscripten-tutorial-ab0db69a7b11ba1a9dc52d50c94e9e321b70ebf0.tar.gz emscripten-tutorial-ab0db69a7b11ba1a9dc52d50c94e9e321b70ebf0.zip | |
Added example 6
Diffstat (limited to '')
| -rw-r--r-- | 06_storage/init_idbfs.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/06_storage/init_idbfs.js b/06_storage/init_idbfs.js new file mode 100644 index 0000000..82483f4 --- /dev/null +++ b/06_storage/init_idbfs.js | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Module['preRun'] = [ | ||
| 2 | async () => { | ||
| 3 | const dir = "/assets"; | ||
| 4 | |||
| 5 | FS.mkdir(dir); | ||
| 6 | FS.mount(IDBFS, { autoPersist: true }, dir); | ||
| 7 | |||
| 8 | Module.fileSystemLoaded = new Promise((resolve, reject) => { | ||
| 9 | FS.syncfs(true, (err) => { | ||
| 10 | if (err) reject(err); | ||
| 11 | else resolve(true); | ||
| 12 | }); | ||
| 13 | }); | ||
| 14 | |||
| 15 | } | ||
| 16 | ]; | ||
