Fullscreen-API-Polyfill
Fullscreen-API-Polyfill copied to clipboard
promise always pending, never update it's status
chorme 69
I think maybe you forgot to register the event of w3.events.change. Because I can see only "dispatch w3.events.change" but none of "addEventListener w3.events.change" in your source code.
My solution is modify your code as follow:
Modify your function which called resolver. Replace all "api.events" as "w3.events" under this function
function createResolver(method) {
return function resolver(resolve, reject) {
// Reject the promise if asked to exitFullscreen and there is no element currently in fullscreen
if (method === w3.exit && !doc[api.element]) {
setTimeout(function () {
reject(new TypeError());
}, 1);
return;
}
// When receiving an internal fullscreenchange event, fulfill the promise
function change() {
resolve();
doc.removeEventListener(w3.events.change, change, false);
}
// When receiving an internal fullscreenerror event, reject the promise
function error() {
reject(new TypeError());
doc.removeEventListener(w3.events.error, error, false);
}
doc.addEventListener(w3.events.change, change, false);
doc.addEventListener(w3.events.error, error, false);
};
}
Same issue here 👍
Same problem on safari 14.1.1 (OSX). The code above fixes it. 👍