Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.controls3d) {
this.controls3d.dispose();
this.controls3d = null;
}
if (this.canvasPlayerControls) {
this.canvasPlayerControls.dispose();
this.canvasPlayerControls = null;
}
if (this.effect) {
this.effect.dispose();
this.effect = null;
}
window.removeEventListener('resize', this.handleResize_, true);
window.removeEventListener('vrdisplaypresentchange', this.handleResize_, true);
window.removeEventListener('vrdisplayactivate', this.handleVrDisplayActivate_, true);
window.removeEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_, true);
// re-add the big play button to player
if (!this.player_.getChild('BigPlayButton')) {
this.player_.addChild('BigPlayButton', {}, this.bigPlayButtonIndex_);
}
if (this.player_.getChild('BigVrPlayButton')) {
this.player_.removeChild('BigVrPlayButton');
}
// remove the cardboard button
if (this.player_.getChild('CardboardButton')) {
this.player_.controlBar.removeChild('CardboardButton');
this.controls3d = null;
}
if (this.canvasPlayerControls) {
this.canvasPlayerControls.dispose();
this.canvasPlayerControls = null;
}
if (this.effect) {
this.effect.dispose();
this.effect = null;
}
window.removeEventListener('resize', this.handleResize_, true);
window.removeEventListener('vrdisplaypresentchange', this.handleResize_, true);
window.removeEventListener('vrdisplayactivate', this.handleVrDisplayActivate_, true);
window.removeEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_, true);
// re-add the big play button to player
if (!this.player_.getChild('BigPlayButton')) {
this.player_.addChild('BigPlayButton', {}, this.bigPlayButtonIndex_);
}
if (this.player_.getChild('BigVrPlayButton')) {
this.player_.removeChild('BigVrPlayButton');
}
// remove the cardboard button
if (this.player_.getChild('CardboardButton')) {
this.player_.controlBar.removeChild('CardboardButton');
}
}
if (this.canvasPlayerControls) {
this.canvasPlayerControls.dispose();
this.canvasPlayerControls = null;
}
if (this.effect) {
this.effect.dispose();
this.effect = null;
}
window.removeEventListener('resize', this.handleResize_, true);
window.removeEventListener('vrdisplaypresentchange', this.handleResize_, true);
window.removeEventListener('vrdisplayactivate', this.handleVrDisplayActivate_, true);
window.removeEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_, true);
// re-add the big play button to player
if (!this.player_.getChild('BigPlayButton')) {
this.player_.addChild('BigPlayButton', {}, this.bigPlayButtonIndex_);
}
if (this.player_.getChild('BigVrPlayButton')) {
this.player_.removeChild('BigVrPlayButton');
}
// remove the cardboard button
if (this.player_.getChild('CardboardButton')) {
this.player_.controlBar.removeChild('CardboardButton');
}
// show the fullscreen again
function onup(ev) {
window.removeEventListener("mousemove", onmove)
window.removeEventListener("mouseup", onup)
}
dispose() {
super.dispose();
window.removeEventListener('vrdisplayactivate', this.handleVrDisplayActivate_);
window.removeEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_);
window.removeEventListener('vrdisplaypresentchange', this.handleVrDisplayPresentChange_);
}
function setWindowLoaded() {
_windowLoaded = true;
window.removeEventListener('load', setWindowLoaded);
}
dispose() {
super.dispose();
window.removeEventListener('vrdisplayactivate', this.handleVrDisplayActivate_);
window.removeEventListener('vrdisplaydeactivate', this.handleVrDisplayDeactivate_);
window.removeEventListener('vrdisplaypresentchange', this.handleVrDisplayPresentChange_);
}