This commit is contained in:
Magnus Åhall 2024-11-30 17:10:46 +01:00
parent 9a164b984a
commit 5c2842c995
8 changed files with 330 additions and 26 deletions

View file

@ -15,25 +15,23 @@
"imports": {
"preact": "/js/{{ .VERSION }}/lib/preact/preact.mjs",
"preact/hooks": "/js/{{ .VERSION }}/lib/preact/hooks.mjs",
{{- if .Data._dev }}
"preact/debug": "/js/{{ .VERSION }}/lib/preact/debug.mjs",
"preact/devtools": "/js/{{ .VERSION }}/lib/preact/devtools.mjs",
{{- end }}
"@preact/signals-core": "/js/{{ .VERSION }}/lib/signals/signals-core.mjs",
"preact/signals": "/js/{{ .VERSION }}/lib/signals/signals.mjs",
"htm": "/js/{{ .VERSION }}/lib/htm/htm.mjs",
"api": "/js/{{ .VERSION }}/api.mjs",
"key": "/js/{{ .VERSION }}/key.mjs",
"checklist": "/js/{{ .VERSION }}/checklist.mjs",
"crypto": "/js/{{ .VERSION }}/crypto.mjs",
"node": "/js/{{ .VERSION }}/node.mjs"
"api": "/js/{{ .VERSION }}/api.mjs",
"key": "/js/{{ .VERSION }}/key.mjs",
"checklist": "/js/{{ .VERSION }}/checklist.mjs",
"crypto": "/js/{{ .VERSION }}/crypto.mjs",
"node_store": "/js/{{ .VERSION }}/node_store.mjs",
"node": "/js/{{ .VERSION }}/node.mjs"
{{/*
"session": "/js/{{ .VERSION }}/session.mjs",
"node": "/js/{{ .VERSION }}/node.mjs",
"node_store": "/js/{{ .VERSION }}/node_store.mjs",
"key": "/js/{{ .VERSION }}/key.mjs",
"crypto": "/js/{{ .VERSION }}/crypto.mjs",
"checklist": "/js/{{ .VERSION }}/checklist.mjs",
"ws": "/_js/{{ .VERSION }}/websocket.mjs"
"session": "/js/{{ .VERSION }}/session.mjs",
"ws": "/_js/{{ .VERSION }}/websocket.mjs"
*/}}
}
}

View file

@ -8,6 +8,7 @@ import htm from 'htm'
import 'preact/debug'
import 'preact/devtools'
{{- end }}
import { NodeStore } from 'node_store'
import { Notes2 } from "/js/{{ .VERSION }}/app.mjs"
import { API } from 'api'
@ -15,8 +16,15 @@ if (!API.hasAuthenticationToken()) {
location.href = '/login'
} else {
const html = htm.bind(h)
window._notes2 = createRef()
render(html`<${Notes2} ref=${window._notes2} />`, document.getElementById('app'))
try {
window.nodeStore = new NodeStore()
window.nodeStore.initializeDB().then(() => {
window._notes2 = createRef()
render(html`<${Notes2} ref=${window._notes2} />`, document.getElementById('app'))
})
} catch (e) {
alert(e)
}
}
</script>