mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
fixed palette import bug
This commit is contained in:
17
src/js/utils/WorkerUtils.js
Normal file
17
src/js/utils/WorkerUtils.js
Normal file
@@ -0,0 +1,17 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.utils');
|
||||
|
||||
var workers = {};
|
||||
|
||||
ns.WorkerUtils = {
|
||||
createWorker : function (worker, workerId) {
|
||||
if (!workers[workerId]) {
|
||||
var typedArray = [(worker+"").replace(/function \(\)\s?\{/,"").replace(/\}[^}]*$/, "")];
|
||||
var blob = new Blob(typedArray, {type: "application/javascript"}); // pass a useful mime type here
|
||||
workers[workerId] = window.URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
return new Worker(workers[workerId]);
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user