diff --git a/assets/js/main.ts b/assets/js/main.ts index db01e77..6c422db 100644 --- a/assets/js/main.ts +++ b/assets/js/main.ts @@ -1,23 +1,25 @@ import { createApp } from './lib/petite-vue.es.js' -createApp({ +const appdata = { $delimiters: ['{|', '|}'], urlParams: new URL(location.href).searchParams, poll, newdata: '', data: '', save -}).mount() +} + +createApp(appdata).mount() + +appdata.poll() + +// method definitions function save() { this.data += '\n' + this.newdata this.newdata = '' } -//let pwait = new Promise(function(resolve, reject) { -// poll() -//}) - function poll() { fetch('http://localhost:8125/api/system/poll/service/pclt-0001') .then((res) => res.json()) @@ -30,15 +32,3 @@ function poll() { return null } -function Data() { - return { - data: '', - save(txt: string) { - this.data += '\n' + txt - } - } -} - -// p = new URL(location.href).searchParams -// id = p.get('id') - diff --git a/layouts/partials/js.html b/layouts/partials/js.html index 8162381..9da137d 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -1,3 +1,2 @@ {{ $js := resources.Get "js/main.ts" | js.Build (dict "minify" false) }} -
{| poll() |}