mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2025-03-11 01:29:11 +00:00
21 lines
486 B
JavaScript
21 lines
486 B
JavaScript
importScripts(
|
|
'https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@latest/lib/wasm_exec/wasm_exec.js',
|
|
'https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@latest/index.js',
|
|
)
|
|
|
|
console.log('scope', registration.scope)
|
|
|
|
addEventListener('install', event => {
|
|
console.log('install!')
|
|
wasmhttp.serve({
|
|
wasm: 'api.wasm',
|
|
base: '/api',
|
|
})
|
|
skipWaiting()
|
|
})
|
|
|
|
addEventListener('activate', event => {
|
|
console.log('activate!')
|
|
event.waitUntil(clients.claim())
|
|
})
|