Przeglądaj źródła

check if the window object is defined before starting the WebVRManager

Duncan Alexander 8 lat temu
rodzic
commit
f122471c3a
3 zmienionych plików z 20 dodań i 16 usunięć
  1. 7 7
      build/three.js
  2. 7 7
      build/three.module.js
  3. 6 2
      src/renderers/webvr/WebVRManager.js

Plik diff jest za duży
+ 7 - 7
build/three.js


Plik diff jest za duży
+ 7 - 7
build/three.module.js


+ 6 - 2
src/renderers/webvr/WebVRManager.js

@@ -14,7 +14,7 @@ function WebVRManager( renderer ) {
 	var device = null;
 	var device = null;
 	var frameData = null;
 	var frameData = null;
 
 
-	if ( 'VRFrameData' in window ) {
+	if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
 
 
 		frameData = new window.VRFrameData();
 		frameData = new window.VRFrameData();
 
 
@@ -62,7 +62,11 @@ function WebVRManager( renderer ) {
 
 
 	}
 	}
 
 
-	window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
+	if ( typeof window !== 'undefined' ) {
+
+		window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
+
+	}
 
 
 	//
 	//
 
 

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików

粤ICP备19079148号