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
}
