Check to see if screenfull is initialized (#62)

Co-authored-by: Miguel Sozinho Ramalho <19508417+msramalho@users.noreply.github.com>
This commit is contained in:
Logan Williams
2023-01-11 11:32:40 +01:00
committed by GitHub
parent ad1ccc4fd3
commit b6c3db70ac

View File

@@ -15,11 +15,11 @@ export class FullscreenToggle extends React.Component {
}
componentDidMount() {
screenfull.on("change", this.onFullscreenStateChange);
if (screenfull.on) screenfull.on("change", this.onFullscreenStateChange);
}
componentWillUnmount() {
screenfull.off("change", this.onFullscreenStateChange);
if (screenfull.off) screenfull.off("change", this.onFullscreenStateChange);
}
onFullscreenStateChange(evt) {