git @ Cat's Eye Technologies Dipple / master javascript / web-worker.js
master

Tree @master (Download .tar.gz)

web-worker.js @masterraw · history · blame

// SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
// For more information, please refer to <https://unlicense.org/>
// SPDX-License-Identifier: Unlicense

var something = 5;

importScripts('worker-library.js');

postMessage("Hello!\n");

addEventListener('message', function(e) {
    if (e.data[0] === 'start') {
        postMessage("started\n");
        something += e.data[1];
        setInterval(function() {
            something = closure(something);
            postMessage("Value: " + something + "\n");
        }, 100);
    }
});