How to pass functions to JavaScript Web Worker

Turns out this method works fine, there was merely a bug in my worker:

var result = greeter("john");

should be

var result = greet("john");

which makes sense – I’m passing the greeter variable to the worker, but there’s no reason for it to know the variable name of the object I’m passing.

Leave a Comment