Skip to content

Commit

Permalink
Replace .terminateWorker() with .worker()
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Oct 16, 2015
1 parent 14e044c commit ed9c398
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -86,7 +86,7 @@ If the decompression progress is unable to be calculated, the on_progress() func

LZMA-JS will try to use Web Workers if they are available. If the environment does not support Web Workers,
it will just do something else, and it won't pollute the global scope.
Each call to LZMA() will create a new Web Worker, which can be reused or terminated via my_lzma.terminateWorker().
Each call to LZMA() will create a new Web Worker, which can be accessed via my_lzma.worker().

LZMA-JS was originally based on gwt-lzma, which is a port of the LZMA SDK from Java into JavaScript.

Expand Down
7 changes: 3 additions & 4 deletions src/lzma.js
Expand Up @@ -63,7 +63,7 @@ if (typeof Worker === "undefined" || (typeof location !== "undefined" && locatio
}, 50);
}
},
terminateWorker: function() {}
worker: function() { return null; }
};

return fake_lzma;
Expand Down Expand Up @@ -138,9 +138,8 @@ if (typeof Worker === "undefined" || (typeof location !== "undefined" && locatio
decompress: function decompress(byte_arr, on_finish, on_progress) {
send_to_worker(action_decompress, byte_arr, false, on_finish, on_progress);
},
terminateWorker: function terminateWorker() {
lzma_worker.terminate();
lzma_worker = null;
worker: function worker() {
return lzma_worker;
}
};
}());
Expand Down
2 changes: 1 addition & 1 deletion src/lzma_worker.js
Expand Up @@ -2629,7 +2629,7 @@ var LZMA = (function () {
/** xs */
compress: compress,
decompress: decompress,
terminateWorker: function() {}
worker: function() { return null; }
/** xe */
/// co:compress: compress
/// do:decompress: decompress
Expand Down

0 comments on commit ed9c398

Please sign in to comment.