Skip to content

Commit

Permalink
Merge pull request #10 from Kanaye/fix-#8
Browse files Browse the repository at this point in the history
Check if postMessage has 1 argument.
  • Loading branch information
developit committed Mar 8, 2019
2 parents e4fa082 + d9aa568 commit dd83f17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/worker.js
Expand Up @@ -30,7 +30,7 @@ export default function createWorkerStore(initialState) {
onThaw = [],
sendQueue = [],
lock = false;

for (let i in initialState) currentState[i] = initialState[i];

function send(opts) {
Expand All @@ -40,7 +40,7 @@ export default function createWorkerStore(initialState) {
}

function processSendQueue() {
if (typeof postMessage==='function') postMessage(sendQueue);
if (typeof postMessage==='function' && postMessage.length === 1) postMessage(sendQueue);
sendQueue.length = 0;
}

Expand Down

0 comments on commit dd83f17

Please sign in to comment.