|
|
|
@ -4,17 +4,21 @@ async function autoUpdate(url, interval, callback = () => {}, method = 'post') {
|
|
|
|
|
type: method,
|
|
|
|
|
url: url,
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
timeout:9000,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
setTimeout(() => autoUpdate(url, interval, callback, method), interval)
|
|
|
|
|
callback(data)
|
|
|
|
|
resolve(data)
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
error: function (reason) {
|
|
|
|
|
setTimeout(() => autoUpdate(url, interval, callback, method), interval)
|
|
|
|
|
console.error(reason)
|
|
|
|
|
reject(reason)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() => autoUpdate(url, interval, callback, method), interval)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const INTERVAL = 10000
|
|
|
|
|