In order to instantiate a new Worker, the logic is the following:
var w = new Worker("demo_workers.js");
demo_workers.js contains the definition of what the worker will do. Is it possible to avoid the creation of a new .js and pass an internal function to that constructor? Something like
var w = new Worker(
   function(){
       alert("hey!");
   };
);