NodeThreadsWorker.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. /// <reference types="node" />
  8. import { ChildMessage, OnCustomMessage, OnEnd, OnStart, WorkerInterface, WorkerOptions } from '../types';
  9. export default class ExperimentalWorker implements WorkerInterface {
  10. private _worker;
  11. private _options;
  12. private _request;
  13. private _retries;
  14. private _onProcessEnd;
  15. private _onCustomMessage;
  16. private _fakeStream;
  17. private _stdout;
  18. private _stderr;
  19. private _exitPromise;
  20. private _resolveExitPromise;
  21. private _forceExited;
  22. constructor(options: WorkerOptions);
  23. initialize(): void;
  24. private _shutdown;
  25. private _onMessage;
  26. private _onExit;
  27. waitForExit(): Promise<void>;
  28. forceExit(): void;
  29. send(request: ChildMessage, onProcessStart: OnStart, onProcessEnd: OnEnd | null, onCustomMessage: OnCustomMessage): void;
  30. getWorkerId(): number;
  31. getStdout(): NodeJS.ReadableStream | null;
  32. getStderr(): NodeJS.ReadableStream | null;
  33. private _getFakeStream;
  34. }