WebWorkerDedicatedExecutor
A serial executor that runs on a dedicated web worker thread.
- iOS
- 18.0+
- macOS
- 15.0+
- tvOS
- 18.0+
- visionOS
- 2.0+
- watchOS
- 11.0+
final class WebWorkerDedicatedExecutor
This executor is useful for running actors on a dedicated web worker thread.
Usage
actor MyActor {
let executor: WebWorkerDedicatedExecutor
nonisolated var unownedExecutor: UnownedSerialExecutor {
self.executor.asUnownedSerialExecutor()
}
init(executor: WebWorkerDedicatedExecutor) {
self.executor = executor
}
}
let executor = try await WebWorkerDedicatedExecutor()
let actor = MyActor(executor: executor)