xref: /third_party/node/test/fixtures/worker-name.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/
11cb0ef41Sopenharmony_ciconst { Session } = require('inspector');
21cb0ef41Sopenharmony_ciconst { parentPort } = require('worker_threads');
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciconst session = new Session();
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciparentPort.once('message', () => {}); // Prevent the worker from exiting.
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_cisession.connectToMainThread();
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cisession.on(
111cb0ef41Sopenharmony_ci  'NodeWorker.attachedToWorker',
121cb0ef41Sopenharmony_ci  ({ params: { workerInfo } }) => {
131cb0ef41Sopenharmony_ci    // send the worker title to the main thread
141cb0ef41Sopenharmony_ci    parentPort.postMessage(workerInfo.title);
151cb0ef41Sopenharmony_ci  }
161cb0ef41Sopenharmony_ci);
171cb0ef41Sopenharmony_cisession.post('NodeWorker.enable', { waitForDebuggerOnStart: false });
18

Indexes created Thu Nov 07 10:32:03 CST 2024