loadWorkerContext

suspend fun loadWorkerContext(vararg npmPackages: NpmPackage, allowLoadingDuplicates: Boolean = true, loader: SimpleWorkerContext.IContextResourceLoader? = null): IWorkerContext

Loads and initializes a worker context with the specified npm packages.

This sample test demonstrates how to use loadWorkerContext API.

Return

An initialized instance of IWorkerContext.

Parameters

npmPackages

The npm packages to be loaded into the worker context.

allowLoadingDuplicates

Flag indicating whether loading duplicate packages is allowed. Default is true.

loader

Custom resource loader for the worker context. Default is null, meaning the default loader will be used.