(function () {
    'use strict';

    let timer = null;
    onmessage = function (request) {
        const time = request.data;
        if (time >= 0)
            timer = setTimeout(() => postMessage(""), time);
        else if (timer)
            clearTimeout(timer);
    };

})();
