provide confdata as type
This commit is contained in:
parent
1ad9e70c00
commit
5f793c354e
1 changed files with 9 additions and 8 deletions
|
@ -1,16 +1,16 @@
|
||||||
import { api, polling } from './settings'
|
import { api, polling } from './settings'
|
||||||
|
|
||||||
const confdata = {
|
type confdata = {
|
||||||
pollurl: ''
|
pollurl: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function config (api, polling) {
|
export function config (api, polling): confdata {
|
||||||
return undefined
|
return { pollurl: '' }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const pvapp = {
|
export const pvapp = {
|
||||||
$delimiters: ['{|', '|}'],
|
$delimiters: ['{|', '|}'],
|
||||||
conf: confdata,
|
conf: {} as confdata,
|
||||||
data: {},
|
data: {},
|
||||||
output: '',
|
output: '',
|
||||||
save,
|
save,
|
||||||
|
@ -28,9 +28,10 @@ async function dopoll(app: typeof pvapp) {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
let res = await fetch(pvapp.conf.pollurl)
|
let res = await fetch(pvapp.conf.pollurl)
|
||||||
let data = await res.json()
|
let msg = await res.json()
|
||||||
console.log(data)
|
console.log(msg)
|
||||||
//obj.newdata = data['status']
|
//app.handle(msg)
|
||||||
|
//app.newdata = data['status']
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
await new Promise(r => setTimeout(r, 10000))
|
await new Promise(r => setTimeout(r, 10000))
|
||||||
|
|
Loading…
Add table
Reference in a new issue