src/rainbow.js
function _messageWorker(message, callback) {
    const worker = _getWorker();

    function _listen(e) {
        if (e.data.id === message.id) {
            callback(e.data);
            worker.removeEventListener('message', _listen);
        }
    }

    worker.addEventListener('message', _listen);
    worker.postMessage(message);
}
function _messageWorker(message, callback) {
    const worker = _getWorker();

    function _listen(e) {
        if (e.data.id === message.id) {
            callback(e.data);
            worker.removeEventListener('message', _listen);
        }
    }

    worker.addEventListener('message', _listen);
    worker.postMessage(message);
}
function _messageWorker ( message , callback ) { const worker = _getWorker ( ) ; function _listen ( e ) { if ( e . data . id === message . id ) { callback ( e . data ) ; worker . removeEventListener ( 'message' , _listen ) ; } } worker . addEventListener ( 'message' , _listen ) ; worker . postMessage ( message ) ; }
Helper for matching up callbacks directly with the
post message requests to a web worker.

@param {object} message      data to send to web worker
@param {Function} callback   callback function for worker to reply to
@return {void}
Helper for matching up callbacks directly with the post message requests to a web worker .