Skip to content

Instantly share code, notes, and snippets.

@fuzzy
Created October 13, 2017 04:35
Show Gist options
  • Save fuzzy/e11dc182dcab3f01014b38aa0ee438b8 to your computer and use it in GitHub Desktop.
Save fuzzy/e11dc182dcab3f01014b38aa0ee438b8 to your computer and use it in GitHub Desktop.
/*
Events worker
*/
var salt_events;
function startEventsWorker() {
if (typeof(Worker) !== "undefined") {
if (typeof(salt_events) == "undefined") {
salt_events = new Worker("/goat/events.js");
}
salt_events.onmessage = function(event) {
$("#salt_event_output").html = event.data;
};
} else {
document.getElementById("salt_event_output").innerHTML = "Sorry, your browser does not support web workers.";
}
}
function stopEventWorker() {
salt_events.terminate();
salt_events = undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment