Skip to content

Commit

Permalink
MessageChannel-postMessage-error-handle (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
polikm5 committed May 8, 2024
1 parent 8a80165 commit 25ee749
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions channel-messaging-multimessage/page2.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@

// Setup the transfered port
function initPort(e) {
port2 = e.ports[0];
port2.onmessage = onMessage;
if (e.ports[0]) {
port2 = e.ports[0];
port2.onmessage = onMessage;
}
}

// Handle messages received on port2
Expand Down

0 comments on commit 25ee749

Please sign in to comment.