(
path: string,
workerFns: (keyof T)[],
hostFns: H,
root: string,
exitMain = true,
workerData?: any
)
| 204 | } |
| 205 | |
| 206 | static create<T extends AsyncMethods, H extends AsyncMethods>( |
| 207 | path: string, |
| 208 | workerFns: (keyof T)[], |
| 209 | hostFns: H, |
| 210 | root: string, |
| 211 | exitMain = true, |
| 212 | workerData?: any |
| 213 | ): Worker<T> & T { |
| 214 | const worker = new Worker( |
| 215 | new workers.Worker(path, { |
| 216 | argv: [...process.argv, '--root', root], |
| 217 | workerData, |
| 218 | }), |
| 219 | workerFns, |
| 220 | hostFns, |
| 221 | exitMain |
| 222 | ); |
| 223 | |
| 224 | return worker as Worker<T> & T; |
| 225 | } |
| 226 | |
| 227 | // Host requests are in decreasing ID while Worker is increasing IDs to not conflict |
| 228 | protected getReqId(): number { |
no outgoing calls
no test coverage detected