diff --git a/guide/api-environment-runtimes.md b/guide/api-environment-runtimes.md index 5ab11fff..f1e3d5d6 100644 --- a/guide/api-environment-runtimes.md +++ b/guide/api-environment-runtimes.md @@ -304,7 +304,7 @@ function createWorkerEnvironment(name, config, context) { const handlerToWorkerListener = new WeakMap() const workerHotChannel = { - send: (data) => w.postMessage(data), + send: (data) => worker.postMessage(data), on: (event, handler) => { if (event === 'connection') return @@ -312,20 +312,20 @@ function createWorkerEnvironment(name, config, context) { if (value.type === 'custom' && value.event === event) { const client = { send(payload) { - w.postMessage(payload) + worker.postMessage(payload) }, } handler(value.data, client) } } handlerToWorkerListener.set(handler, listener) - w.on('message', listener) + worker.on('message', listener) }, off: (event, handler) => { if (event === 'connection') return const listener = handlerToWorkerListener.get(handler) if (listener) { - w.off('message', listener) + worker.off('message', listener) handlerToWorkerListener.delete(handler) } },