import { api, polling } from './settings' const confdata = { pollurl: '' } export function config (api, polling) { return undefined } export const pvapp = { $delimiters: ['{|', '|}'], conf: confdata, data: {}, output: '', save, poll } // method definitions function save(value: string) { this.output += '\n' + value //this.newdata = '' } async function dopoll(app: typeof pvapp) { while (true) { try { let res = await fetch(pvapp.conf.pollurl) let data = await res.json() console.log(data) //obj.newdata = data['status'] } catch (error) { console.log(error) await new Promise(r => setTimeout(r, 10000)) } } } function poll() { dopoll(this) }