MCPcopy
hub / github.com/facebook/react / patchMessageChannel

Function patchMessageChannel

scripts/jest/patchMessageChannel.js:3–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1'use strict';
2
3export function patchMessageChannel() {
4 global.MessageChannel = class {
5 constructor() {
6 const port1 = {
7 onmesssage: () => {},
8 };
9
10 this.port1 = port1;
11
12 this.port2 = {
13 postMessage(msg) {
14 setTimeout(() => {
15 port1.onmessage(msg);
16 }, 0);
17 },
18 };
19 }
20 };
21}

Calls

no outgoing calls

Tested by

no test coverage detected