34 lines
588 B
TypeScript
34 lines
588 B
TypeScript
import { createApp } from './lib/petite-vue.es.js'
|
|
|
|
const appdata = {
|
|
$delimiters: ['{|', '|}'],
|
|
urlParams: new URL(location.href).searchParams,
|
|
poll,
|
|
newdata: '',
|
|
data: '',
|
|
save
|
|
}
|
|
|
|
createApp(appdata).mount()
|
|
|
|
appdata.poll()
|
|
|
|
// method definitions
|
|
|
|
function save() {
|
|
this.data += '\n' + this.newdata
|
|
this.newdata = ''
|
|
}
|
|
|
|
function poll() {
|
|
fetch('http://localhost:8125/api/system/poll/service/pclt-0001')
|
|
.then((res) => res.json())
|
|
.then((data) => {
|
|
console.log(data)
|
|
this.newdata = data['status']
|
|
this.poll()
|
|
})
|
|
console.log('after fetch')
|
|
return null
|
|
}
|
|
|