Просмотр исходного кода

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 месяцев назад
Родитель
Сommit
5f4b079cc9
1 измененных файлов с 2 добавлено и 2 удалено
  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号