game-multi-test / client /components /fullscreenEvent.js
Omnibus's picture
Upload 27 files
c679a93
raw
history blame contribute delete
541 Bytes
// listen for fullscreen change event
const FullScreenEvent = callback => {
const fullScreenChange = () => {
let times = [50, 100, 200, 500, 1000, 2000, 5000]
times.forEach(time => {
window.setTimeout(() => {
callback()
}, time)
})
}
var vendors = ['webkit', 'moz', 'ms', '']
vendors.forEach(prefix => {
document.addEventListener(prefix + 'fullscreenchange', fullScreenChange, false)
})
document.addEventListener('MSFullscreenChange', fullScreenChange, false)
}
export default FullScreenEvent