1importScripts('primes.js'); 2 3var primes = new Primes(); 4 5onmessage = function(event) { 6 var p = event.data; 7 if (p != parseInt(p)) 8 throw 'invalid argument'; 9 postMessage([p, primes.test(p)]); 10} 11