diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-12-31 11:56:53 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-12-31 11:56:53 -0800 |
commit | 2325baf34e144586d71251f31c01c7f2abfdb8b7 (patch) | |
tree | 6dec7e37e75040034d443786d4701e62b38a4d6d /src/library_browser.js | |
parent | 8aa6919b7acf0b4034735ac7ee597e946fefaf4d (diff) | |
parent | a55c2a24a50a93fcf9035eb2a809d13d3a8d3555 (diff) |
Merge branch 'incoming' into asm_js
Conflicts:
src/library_browser.js
Diffstat (limited to 'src/library_browser.js')
-rw-r--r-- | src/library_browser.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index ef8b4360..32a7d2cc 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -336,11 +336,11 @@ mergeInto(LibraryManager.library, { xhr.send(null); }, - asyncLoad: function(url, onload, onerror) { + asyncLoad: function(url, onload, onerror, noRunDep) { Browser.xhrLoad(url, function(arrayBuffer) { assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).'); onload(new Uint8Array(arrayBuffer)); - removeRunDependency('al ' + url); + if (!noRunDep) removeRunDependency('al ' + url); }, function(event) { if (onerror) { onerror(); @@ -348,7 +348,7 @@ mergeInto(LibraryManager.library, { throw 'Loading data file "' + url + '" failed.'; } }); - addRunDependency('al ' + url); + if (!noRunDep) addRunDependency('al ' + url); }, resizeListeners: [], @@ -385,6 +385,17 @@ mergeInto(LibraryManager.library, { ); }, + emscripten_async_wget_data: function(url, arg, onload, onerror) { + Browser.asyncLoad(Pointer_stringify(url), function(byteArray) { + var buffer = _malloc(byteArray.length); + HEAPU8.set(byteArray, buffer); + FUNCTION_TABLE[onload](arg, buffer, byteArray.length); + _free(buffer); + }, function() { + if (onerror) FUNCTION_TABLE[onerror](arg); + }, true /* no need for run dependency, this is async but will not do any prepare etc. step */ ); + }, + emscripten_async_prepare: function(file, onload, onerror) { var _file = Pointer_stringify(file); var data = FS.analyzePath(_file); |