diff --git a/src/js/worker/ImageProcessor.js b/src/js/worker/ImageProcessor.js index 0cc80209..53deb72d 100644 --- a/src/js/worker/ImageProcessor.js +++ b/src/js/worker/ImageProcessor.js @@ -1,9 +1,9 @@ (function () { var ns = $.namespace('pskl.worker'); - var worker = function () { - + var imageProcessorWorker = function () { var currentStep, currentProgress, currentTotal; + var initStepCounter_ = function (total) { currentStep = 0; currentProgress = 0; @@ -88,15 +88,6 @@ }; }; - try { - // create worker from blob - var typedArray = [(worker+"").replace(/function \(\) \{/,"").replace(/\}[^}]*$/, "")]; - var blob = new Blob(typedArray, {type: "application/javascript"}); // pass a useful mime type here - var blobUrl = window.URL.createObjectURL(blob); - } catch (e) { - console.error("Could not create worker", e.message); - } - ns.ImageProcessor = function (image, onSuccess, onStep, onError) { this.image = image; @@ -104,7 +95,8 @@ this.onSuccess = onSuccess; this.onError = onError; - this.worker = new Worker(blobUrl); + // var worker = pskl.utils.WorkerUtils.addPartialWorker(imageProcessorWorker, 'step-counter'); + this.worker = pskl.utils.WorkerUtils.createWorker(worker, 'image-colors-processor'); this.worker.onmessage = this.onWorkerMessage.bind(this); }; diff --git a/src/piskel-script-list.js b/src/piskel-script-list.js index b46e240b..6baecef6 100644 --- a/src/piskel-script-list.js +++ b/src/piskel-script-list.js @@ -26,6 +26,7 @@ "js/utils/Template.js", "js/utils/UserSettings.js", "js/utils/Uuid.js", + "js/utils/WorkerUtils.js", "js/utils/Xhr.js", "js/utils/serialization/Serializer.js", "js/utils/serialization/Deserializer.js",