common.d.ts 1.0 KB

123456789101112131415161718192021222324252627282930
  1. import type { Histogram } from 'node:perf_hooks';
  2. import type { HistogramSummary } from './types';
  3. export declare const READY = "_WORKER_READY";
  4. /**
  5. * True if the object implements the Transferable interface
  6. *
  7. * @export
  8. * @param {unknown} value
  9. * @return {*} {boolean}
  10. */
  11. export declare function isTransferable(value: unknown): boolean;
  12. /**
  13. * True if object implements Transferable and has been returned
  14. * by the Piscina.move() function
  15. *
  16. * TODO: narrow down the type of value
  17. * @export
  18. * @param {(unknown & PiscinaMovable)} value
  19. * @return {*} {boolean}
  20. */
  21. export declare function isMovable(value: any): boolean;
  22. export declare function markMovable(value: {}): void;
  23. export declare const commonState: {
  24. isWorkerThread: boolean;
  25. workerData: undefined;
  26. };
  27. export declare function createHistogramSummary(histogram: Histogram): HistogramSummary;
  28. export declare function toHistogramIntegerNano(milliseconds: number): number;
  29. export declare function maybeFileURLToPath(filename: string): string;
  30. export declare function getAvailableParallelism(): number;