Skip to content

Instantly share code, notes, and snippets.

@delapuente
Last active December 24, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delapuente/6875496 to your computer and use it in GitHub Desktop.
Save delapuente/6875496 to your computer and use it in GitHub Desktop.
A simple web worker
/*
Used to include another JS file.
*/
FIB_URL = 'https://gist.githubusercontent.com/lodr/6879872/raw/1dd7315fbac1194abf40406331cf825f74b71ccb/fib.js';
importScripts(FIB_URL);
/*
This is used to receive data from the parent.
*/
onmessage = function(evt) {
var result = fib(eval(evt.data));
/*
This is used to send data to the parent.
*/
postMessage(result);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment