温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/globals/WorkerOptions
点击访问原文链接

interface WorkerOptions | globals module | Bun

interface WorkerOptions | globals module | BunBuildDocsReferenceGuidesBlogDiscord/Globals/WorkerOptionsPargvPcredentialsPenvPnamePpreloadPrefPsmolPtype

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Globals/WorkerOptionsPargvPcredentialsPenvPnamePpreloadPrefPsmolPtype

interface

WorkerOptionsinterface WorkerOptionsBun's Web Worker constructor supports some extra options on top of the API browsers have.

argv?: any[]List of arguments which would be stringified and appended to Bun.argv / process.argv in the worker. This is mostly similar to the data but the values will be available on the global Bun.argv as if they were passed as CLI options to the script.

credentials?: RequestCredentialsIn Bun, this does nothing.

env?: Recordstring, string> | typeof SHARE_ENVIf set, specifies the initial value of process.env inside the Worker thread. As a special value, worker.SHARE_ENV may be used to specify that the parent thread and the child thread should share their environment variables; in that case, changes to one thread's process.env object affect the other thread as well. Default: process.env.

name?: stringA string specifying an identifying name for the DedicatedWorkerGlobalScope representing the scope of the worker, which is mainly useful for debugging purposes.

preload?: string | string[]An array of module specifiers to preload in the worker.

These modules load before the worker's entry point is executed.

Equivalent to passing the --preload CLI argument, but only for this Worker.

ref?: booleanWhen true, the worker will keep the parent thread alive until the worker is terminated or unref'd. When false, the worker will not keep the parent thread alive.

By default, this is false.

smol?: booleanUse less memory, but make the worker slower.

Internally, this sets the heap size configuration in JavaScriptCore to be the small heap instead of the large heap.

type?: WorkerTypeIn Bun, this does nothing.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco

We're hiring →

智能索引记录