
* fix: MessagePort closing unexpectedly with non-cloneable objects * fix: handle serialization failure in parentPort
11 lines
300 B
JavaScript
11 lines
300 B
JavaScript
const nonClonableObject = () => {};
|
|
|
|
process.parentPort.on('message', () => {
|
|
try {
|
|
process.parentPort.postMessage(nonClonableObject);
|
|
} catch (error) {
|
|
if (/An object could not be cloned/.test(error.message)) {
|
|
process.parentPort.postMessage('caught-non-cloneable');
|
|
}
|
|
}
|
|
});
|