diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-04 14:07:02 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-04 14:07:02 +0200 |
commit | 8a419cd95dad82f649f16d339dbbe3de3bb0db32 (patch) | |
tree | b029447e18f5dd13c9ff9777f92e594f3c6b6bb6 /src/library_fs.js | |
parent | a9ef49d8c97dcaed3cc7778acf61de978efdd5ff (diff) |
Give names to most manually assigned functions in the .js files, in form "var x = function()" -> "function x()" so that error stack traces and profiling stack traces are more informative and do not contain anonymous functions.
Diffstat (limited to 'src/library_fs.js')
-rw-r--r-- | src/library_fs.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/library_fs.js b/src/library_fs.js index aece2664..16512385 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -439,7 +439,7 @@ mergeInto(LibraryManager.library, { var completed = 0; var total = FS.mounts.length; - var done = function(err) { + function done(err) { if (err) { return callback(err); } @@ -1326,11 +1326,11 @@ mergeInto(LibraryManager.library, { if (typeof XMLHttpRequest !== 'undefined') { if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse. - var LazyUint8Array = function() { + function LazyUint8Array() { this.lengthKnown = false; this.chunks = []; // Loaded chunks. Index is the chunk number } - LazyUint8Array.prototype.get = function(idx) { + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { if (idx > this.length-1 || idx < 0) { return undefined; } @@ -1338,10 +1338,10 @@ mergeInto(LibraryManager.library, { var chunkNum = Math.floor(idx / this.chunkSize); return this.getter(chunkNum)[chunkOffset]; } - LazyUint8Array.prototype.setDataGetter = function(getter) { + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { this.getter = getter; } - LazyUint8Array.prototype.cacheLength = function() { + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { // Find length var xhr = new XMLHttpRequest(); xhr.open('HEAD', url, false); @@ -1437,7 +1437,7 @@ mergeInto(LibraryManager.library, { var keys = Object.keys(node.stream_ops); keys.forEach(function(key) { var fn = node.stream_ops[key]; - stream_ops[key] = function() { + stream_ops[key] = function forceLoadLazyFile() { if (!FS.forceLoadFile(node)) { throw new FS.ErrnoError(ERRNO_CODES.EIO); } @@ -1445,7 +1445,7 @@ mergeInto(LibraryManager.library, { }; }); // use a custom read function - stream_ops.read = function(stream, buffer, offset, length, position) { + stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) { if (!FS.forceLoadFile(node)) { throw new FS.ErrnoError(ERRNO_CODES.EIO); } @@ -1539,12 +1539,12 @@ mergeInto(LibraryManager.library, { } catch (e) { return onerror(e); } - openRequest.onupgradeneeded = function() { + openRequest.onupgradeneeded = function openRequest_onupgradeneeded() { console.log('creating db'); var db = openRequest.result; db.createObjectStore(FS.DB_STORE_NAME); }; - openRequest.onsuccess = function() { + openRequest.onsuccess = function openRequest_onsuccess() { var db = openRequest.result; var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite'); var files = transaction.objectStore(FS.DB_STORE_NAME); @@ -1554,8 +1554,8 @@ mergeInto(LibraryManager.library, { } paths.forEach(function(path) { var putRequest = files.put(FS.analyzePath(path).object.contents, path); - putRequest.onsuccess = function() { ok++; if (ok + fail == total) finish() }; - putRequest.onerror = function() { fail++; if (ok + fail == total) finish() }; + putRequest.onsuccess = function putRequest_onsuccess() { ok++; if (ok + fail == total) finish() }; + putRequest.onerror = function putRequest_onerror() { fail++; if (ok + fail == total) finish() }; }); transaction.onerror = onerror; }; @@ -1573,7 +1573,7 @@ mergeInto(LibraryManager.library, { return onerror(e); } openRequest.onupgradeneeded = onerror; // no database to load from - openRequest.onsuccess = function() { + openRequest.onsuccess = function openRequest_onsuccess() { var db = openRequest.result; try { var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly'); @@ -1588,7 +1588,7 @@ mergeInto(LibraryManager.library, { } paths.forEach(function(path) { var getRequest = files.get(path); - getRequest.onsuccess = function() { + getRequest.onsuccess = function getRequest_onsuccess() { if (FS.analyzePath(path).exists) { FS.unlink(path); } @@ -1596,7 +1596,7 @@ mergeInto(LibraryManager.library, { ok++; if (ok + fail == total) finish(); }; - getRequest.onerror = function() { fail++; if (ok + fail == total) finish() }; + getRequest.onerror = function getRequest_onerror() { fail++; if (ok + fail == total) finish() }; }); transaction.onerror = onerror; }; |