diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-10-19 11:23:32 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-10-19 11:23:32 -0700 |
commit | c56013b5a9b664b741278536690faeb27b16aa88 (patch) | |
tree | de258bb2a0e8f67dce82e304c6e4cd5f3c014da1 /src/library_browser.js | |
parent | 9e5680bcc0c14924b060a6d2bb609bcae5b4d62c (diff) |
emscripten_async_prepare_data
Diffstat (limited to 'src/library_browser.js')
-rw-r--r-- | src/library_browser.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index 673f1ff4..fb2fa16b 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -402,6 +402,28 @@ mergeInto(LibraryManager.library, { return 0; }, + emscripten_async_prepare_data: function(data, size, suffix, onload, onerror) { + var _suffix = Pointer_stringify(suffix); + if (!Browser.asyncPrepareDataCounter) Browser.asyncPrepareDataCounter = 0; + var name = 'prepare_data_' + (Browser.asyncPrepareDataCounter++) + '.' + _suffix; + var cname = _malloc(name.length+1); + writeStringToMemory(name, cname); + FS.createPreloadedFile( + '', + name, + {{{ makeHEAPView('U8', 'data', 'data + size') }}}, + true, true, + function() { + if (onload) FUNCTION_TABLE[onload](data, cname); + }, + function() { + if (onerror) FUNCTION_TABLE[onerror](data); + }, + true // don'tCreateFile - it's already there + ); + return 0; + }, + emscripten_async_run_script__deps: ['emscripten_run_script'], emscripten_async_run_script: function(script, millis) { Module['noExitRuntime'] = true; |