Skip to content

Commit

Permalink
Updated demos.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmrugg committed Nov 10, 2013
1 parent 400e371 commit b29719f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/lzma_worker.js
@@ -1,12 +1,12 @@
var LZMA = (function () {
var action_compress = 1,
action_decompress = 2,
action_update = 3;
action_progress = 3;

function update_progress(percent, callback_num) {
///TODO: Calculate ETA.
postMessage({
action: 3,
action: action_progress,
callback_num: callback_num,
result: percent
});
Expand Down Expand Up @@ -3910,10 +3910,12 @@ var LZMA = (function () {
(function create_onmessage() {
/// Create the global onmessage function.
onmessage = function (e) {
if (e.data.action === action_compress) {
LZMA.compress(e.data.data, e.data.mode, e.data.callback_num);
} else {
LZMA.decompress(e.data.data, e.data.callback_num);
if (e && e.data) {
if (e.data.action === action_compress) {
LZMA.compress(e.data.data, e.data.mode, e.data.callback_num);
} else if (e.data.action === action_decompress) {
LZMA.decompress(e.data.data, e.data.callback_num);
}
}
}
}());
Expand Down

0 comments on commit b29719f

Please sign in to comment.