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