Skip to content

Commit 76082e3

Browse files
authored
docs: fix mismatched variable names (#19184)
1 parent e690d8b commit 76082e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/guide/api-environment-runtimes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,28 +304,28 @@ function createWorkerEnvironment(name, config, context) {
304304
const handlerToWorkerListener = new WeakMap()
305305

306306
const workerHotChannel = {
307-
send: (data) => w.postMessage(data),
307+
send: (data) => worker.postMessage(data),
308308
on: (event, handler) => {
309309
if (event === 'connection') return
310310

311311
const listener = (value) => {
312312
if (value.type === 'custom' && value.event === event) {
313313
const client = {
314314
send(payload) {
315-
w.postMessage(payload)
315+
worker.postMessage(payload)
316316
},
317317
}
318318
handler(value.data, client)
319319
}
320320
}
321321
handlerToWorkerListener.set(handler, listener)
322-
w.on('message', listener)
322+
worker.on('message', listener)
323323
},
324324
off: (event, handler) => {
325325
if (event === 'connection') return
326326
const listener = handlerToWorkerListener.get(handler)
327327
if (listener) {
328-
w.off('message', listener)
328+
worker.off('message', listener)
329329
handlerToWorkerListener.delete(handler)
330330
}
331331
},

0 commit comments

Comments
 (0)