Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
moving existing worker to workers
Browse files Browse the repository at this point in the history
  • Loading branch information
Idrinth committed May 31, 2018
1 parent e1c0f10 commit 26b8ea9
Show file tree
Hide file tree
Showing 7 changed files with 427 additions and 555 deletions.
27 changes: 0 additions & 27 deletions src/mods/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,33 +357,6 @@ idrinth.core = {
confirm: function(text, callback) {
idrinth.ui.buildModal("Do you?", text, callback);
},
/**
* runs the inWorker function in the worker and let's the resultHandler handle the result
* @param {Function} inWorker
* @param {Function} resultHandler
* @param {object} values
* @returns {undefined}
*/
addWorker: function(inWorker, resultHandler, values) {
if (!window.Worker) {
return resultHandler(inWorker(values));
}
let blobURL = window.URL.createObjectURL(
new Blob([
"/*js:big*/" +//replaced server-side from libs/[name].js
"self.onmessage = function(message) {var work=" +
inWorker.toString() +
";self.postMessage(work(message.data));self.close();}"
])
);
let worker = new Worker(blobURL);
worker.onmessage = function(message) {
message.target.resultHandler(message.data);
};
worker.resultHandler = resultHandler;
worker.postMessage(values);
window.URL.revokeObjectURL(blobURL);
},
/**
*
* @type {object}
Expand Down
173 changes: 0 additions & 173 deletions src/mods/stats.js

This file was deleted.

Loading

0 comments on commit 26b8ea9

Please sign in to comment.