项目原始demo,不改动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. interface Workers {
  2. (callback: WorkerCallback): void;
  3. (arg1: any, callback: WorkerCallback): void;
  4. (arg1: any, arg2: any, callback: WorkerCallback): void;
  5. (arg1: any, arg2: any, arg3: any, callback: WorkerCallback): void;
  6. (arg1: any, arg2: any, arg3: any, arg4: any, callback: WorkerCallback): void;
  7. }
  8. type WorkerCallback =
  9. | WorkerCallback0
  10. | WorkerCallback1
  11. | WorkerCallback2
  12. | WorkerCallback3
  13. | WorkerCallback4;
  14. type WorkerCallback0 = () => void;
  15. type WorkerCallback1 = (arg1: any) => void;
  16. type WorkerCallback2 = (arg1: any, arg2: any) => void;
  17. type WorkerCallback3 = (arg1: any, arg2: any, arg3: any) => void;
  18. type WorkerCallback4 = (arg1: any, arg2: any, arg3: any, arg4: any) => void;
  19. interface FarmOptions {
  20. maxCallsPerWorker?: number
  21. maxConcurrentWorkers?: number
  22. maxConcurrentCallsPerWorker?: number
  23. maxConcurrentCalls?: number
  24. maxCallTime?: number
  25. maxRetries?: number
  26. autoStart?: boolean
  27. }
  28. interface WorkerFarm {
  29. (name: string): Workers;
  30. (name: string, exportedMethods: string[]): Workers;
  31. (options: FarmOptions, name: string): Workers;
  32. (options: FarmOptions, name: string, exportedMethods: string[]): Workers;
  33. end: (workers: Workers) => void;
  34. }
  35. declare module "worker-farm" {
  36. const workerFarm: WorkerFarm;
  37. export = workerFarm;
  38. }