22 lines
393 B
JavaScript
Executable File
22 lines
393 B
JavaScript
Executable File
export default modules => {
|
|
let self
|
|
self = {
|
|
pingCache: (videoName, callback, interval) => {
|
|
let doFetch
|
|
doFetch = () => {
|
|
fetch(`/cacheInfo?videoName=${videoName}`)
|
|
.then(r => r.json().then(r => {
|
|
const status = r.status
|
|
|
|
if (status == "found")
|
|
callback()
|
|
else
|
|
setTimeout(doFetch, interval)
|
|
}))
|
|
}
|
|
doFetch()
|
|
}
|
|
}
|
|
return self
|
|
}
|