Skip to content

Commit 2b10297

Browse files
committed
extend ThreadsWorkerOptions in CreateWorkerOptions
- pass ThreadsWorkerOptions options to the worker constructor
1 parent 9a7527a commit 2b10297

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/createWorker.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import {getWorkerImplementation as getNodeWorker } from "./master/implementation
33

44
import {
55
BlobWorker,
6+
ThreadsWorkerOptions,
67
WorkerImplementation,
78
} from "./types/master"
89

9-
interface WorkerOptions {
10+
export interface CreateWorkerOptions extends ThreadsWorkerOptions {
1011
backend: string
1112
blob: boolean
1213
}
1314

14-
export function createWorker(workerPath: string & Blob, options: WorkerOptions) {
15+
export function createWorker(workerPath: string & Blob, options: CreateWorkerOptions) {
1516
let WorkerConstructor: typeof WorkerImplementation | typeof BlobWorker
1617
if (options.backend === "web") {
1718
WorkerConstructor = options.blob ?
@@ -28,5 +29,5 @@ export function createWorker(workerPath: string & Blob, options: WorkerOptions)
2829
} else {
2930
throw new Error("The worker backend is not supported.")
3031
}
31-
return new WorkerConstructor(workerPath)
32+
return new WorkerConstructor(workerPath, options)
3233
}

0 commit comments

Comments
 (0)