worker[Symbol.asyncDispose]()


当退出处置范围时调用 worker.terminate()

【Calls worker.terminate() when the dispose scope is exited.】

async function example() {
  await using worker = new Worker('for (;;) {}', { eval: true });
  // Worker is automatically terminate when the scope is exited.
}