Farm.d.ts 841 B

1234567891011121314151617181920212223242526
  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. import { FarmOptions, PromiseWithCustomMessage } from './types';
  8. export default class Farm {
  9. private _computeWorkerKey;
  10. private _cacheKeys;
  11. private _callback;
  12. private _last;
  13. private _locks;
  14. private _numOfWorkers;
  15. private _offset;
  16. private _queue;
  17. constructor(numOfWorkers: number, callback: Function, computeWorkerKey?: FarmOptions['computeWorkerKey']);
  18. doWork(method: string, ...args: Array<unknown>): PromiseWithCustomMessage<unknown>;
  19. private _getNextTask;
  20. private _process;
  21. private _enqueue;
  22. private _push;
  23. private _lock;
  24. private _unlock;
  25. private _isLocked;
  26. }