worker.setEnvironmentData(key[, value])
-
key
<any> 任何可以用作 <Map> 键的任意、可克隆的 JavaScript 值。¥
key
<any> Any arbitrary, cloneable JavaScript value that can be used as a <Map> key. -
value
<any> 任何任意的、可克隆的 JavaScript 值都将被克隆并自动传给所有新的Worker
实例。如果value
作为undefined
传入,则key
之前设置的任何值都将被删除。¥
value
<any> Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all newWorker
instances. Ifvalue
is passed asundefined
, any previously set value for thekey
will be deleted.
worker.setEnvironmentData()
API 设置当前线程中 worker.getEnvironmentData()
的内容以及从当前上下文产生的所有新 Worker
实例。
¥The worker.setEnvironmentData()
API sets the content of
worker.getEnvironmentData()
in the current thread and all new Worker
instances spawned from the current context.