Under normal circumstances, a Web Worker should be passed a URL of the script to execute. However, a local function can also be used
This is done by converting a function to a string, converting that string to a Blob, and converting that Blob to an Object URL.
The code to do this would look a bit like this: