mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
79a500726f
Co-authored-by: 翠 / green <green@sapphi.red>
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')
|