mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2025-03-10 17:29:10 +00:00
⚗️
This commit is contained in:
parent
b4be701615
commit
24d9d2d727
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>go-wasm-http-server demo</title>
|
||||
<script src="https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@b4be701615d284296a4a1aaa852db02f139969ee/index.js"></script>
|
||||
<script>
|
||||
async function hello() {
|
||||
res=await fetch('api/hello', {
|
||||
|
4
index.js
4
index.js
@ -1,9 +1,11 @@
|
||||
const swUrl = 'https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@b4be701615d284296a4a1aaa852db02f139969ee/index.js'
|
||||
|
||||
window.wasmhttp = {
|
||||
register: async (wasm, { scope, base = '' } = {}) => {
|
||||
const options = {}
|
||||
if (scope) options.scope = scope
|
||||
//FIXME register once
|
||||
const registration = await navigator.serviceWorker.register('sw.js', options)
|
||||
const registration = await navigator.serviceWorker.register(swUrl, options)
|
||||
await navigator.serviceWorker.ready
|
||||
registration.active.postMessage({
|
||||
type: 'wasmhttp.register',
|
||||
|
Loading…
x
Reference in New Issue
Block a user