Files
react/scripts/jest/patchMessageChannel.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
359 B
JavaScript
Raw Normal View History

'use strict';
export function patchMessageChannel() {
global.MessageChannel = class {
constructor() {
const port1 = {
onmesssage: () => {},
};
this.port1 = port1;
this.port2 = {
postMessage(msg) {
setTimeout(() => {
port1.onmessage(msg);
}, 0);
},
};
}
};
}