mirror of
https://github.com/hanzoai/vite.git
synced 2026-10-30 19:36:16 +00:00
14 lines
301 B
TypeScript
14 lines
301 B
TypeScript
let inlineSharedWorkerCount = 0
|
|
|
|
// @ts-expect-error onconnect exists in worker
|
|
self.onconnect = (event) => {
|
|
inlineSharedWorkerCount++
|
|
const port = event.ports[0]
|
|
if (inlineSharedWorkerCount >= 2) {
|
|
port.postMessage('pong')
|
|
}
|
|
}
|
|
|
|
// for sourcemap
|
|
console.log('my-inline-shared-worker.js')
|