electron/spec/fixtures/api/utility-process/non-cloneable.js

12 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');
}
}
});