tc39 / proposal-mass-proxy-revocation

Proposal for revoking proxies en masse.
MIT License
5 stars 1 forks source link

example of cross realm abort signal #1

Open bmeck opened 2 years ago

bmeck commented 2 years ago
const worker_threads = require('worker_threads');
const controller = new AbortController();
const {signal} = controller;
new worker_threads.Worker(`
  setTimeout(() => console.log(require('worker_threads').workerData.aborted), 50);
  console.log('ready!')
`, {
  eval: true,
  workerData: signal,
  transferList: [ signal ]
});
setTimeout(() => controller.abort(), 10);