aboutsummaryrefslogtreecommitdiff
path: root/src/library_browser.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-06-21 19:50:24 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-06-21 19:50:24 -0700
commit7e24c1344776fdeec1956372423c618f69a7e91b (patch)
tree751572040688e488cf2f46dbfbe13db168188b39 /src/library_browser.js
parent2abffbd059e9936dbf5a12d03ea69fa47ddf10a6 (diff)
indentation fixes
Diffstat (limited to 'src/library_browser.js')
-rw-r--r--src/library_browser.js62
1 files changed, 29 insertions, 33 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index db012e1d..6015168f 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -148,26 +148,24 @@ mergeInto(LibraryManager.library, {
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function() {
- if (xhr.status == 200) {
- onload(xhr.response);
- } else {
- onerror();
- }
+ if (xhr.status == 200) {
+ onload(xhr.response);
+ } else {
+ onerror();
+ }
};
xhr.onerror = onerror;
xhr.send(null);
},
asyncLoad: function(url, callback) {
- Browser.xhrLoad(url,
- function(arrayBuffer) {
- assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
- callback(new Uint8Array(arrayBuffer));
- removeRunDependency();
- },
- function(event) {
- assert(arrayBuffer, 'Loading data file "' + url + '" failed.');
- });
+ Browser.xhrLoad(url, function(arrayBuffer) {
+ assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
+ callback(new Uint8Array(arrayBuffer));
+ removeRunDependency();
+ }, function(event) {
+ throw 'Loading data file "' + url + '" failed.';
+ });
addRunDependency();
}
},
@@ -175,25 +173,23 @@ mergeInto(LibraryManager.library, {
emscripten_async_wget: function(url, file, onload, onerror) {
url = Pointer_stringify(url);
- Browser.xhrLoad(url,
- function (response) {
- var absolute = Pointer_stringify(file);
- var index = absolute.lastIndexOf('/');
- FS.createDataFile(
- absolute.substr(0, index),
- absolute.substr(index +1),
- new Uint8Array(response),
- true, true);
-
- if (onload) {
- FUNCTION_TABLE[onload](file);
- }
- },
- function (event) {
- if (onerror) {
- FUNCTION_TABLE[onerror](file);
- }
- });
+ Browser.xhrLoad(url, function(response) {
+ var absolute = Pointer_stringify(file);
+ var index = absolute.lastIndexOf('/');
+ FS.createDataFile(
+ absolute.substr(0, index),
+ absolute.substr(index +1),
+ new Uint8Array(response),
+ true, true);
+
+ if (onload) {
+ FUNCTION_TABLE[onload](file);
+ }
+ }, function(event) {
+ if (onerror) {
+ FUNCTION_TABLE[onerror](file);
+ }
+ });
},
emscripten_async_run_script__deps: ['emscripten_run_script'],