Jelajahi Sumber

Animation: Fix ReferenceError in non-broswer environment (#30835)

* Animation: Fix ReferenceError in Node.js environment

Node.js do not support `self`.

* Update Animation.js

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
chirsz 10 bulan lalu
induk
melakukan
5f4b079cc9
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      src/renderers/common/Animation.js

+ 2 - 2
src/renderers/common/Animation.js

@@ -32,9 +32,9 @@ class Animation {
 		 * A reference to the context from `requestAnimationFrame()` can
 		 * be called (usually `window`).
 		 *
-		 * @type {Window|XRSession}
+		 * @type {?(Window|XRSession)}
 		 */
-		this._context = self;
+		this._context = typeof self !== 'undefined' ? self : null;
 
 		/**
 		 * The user-defined animation loop.

粤ICP备19079148号