@needle-tools/engine 2.56.1-pre → 2.56.2-pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "2.56.1-pre",
3
+ "version": "2.56.2-pre",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible, and collaboration and XR come naturally.",
5
5
  "main": "dist/needle-engine.js",
6
6
  "module": "src/needle-engine.ts",
@@ -1,5 +1,5 @@
1
1
  import { TypeStore } from "./../engine_typestore"
2
-
2
+
3
3
  // Import types
4
4
  import { __Ignore } from "../../engine-components/codegen/components.ts";
5
5
  import { AlignmentConstraint } from "../../engine-components/AlignmentConstraint.ts";
@@ -172,7 +172,7 @@ import { XRGrabModel } from "../../engine-components/WebXRGrabRendering.ts";
172
172
  import { XRGrabRendering } from "../../engine-components/WebXRGrabRendering.ts";
173
173
  import { XRRig } from "../../engine-components/WebXRRig.ts";
174
174
  import { XRState } from "../../engine-components/XRFlag.ts";
175
-
175
+
176
176
  // Register types
177
177
  TypeStore.add("__Ignore", __Ignore);
178
178
  TypeStore.add("AlignmentConstraint", AlignmentConstraint);
@@ -562,19 +562,18 @@ class Component implements IComponent, EventTarget {
562
562
 
563
563
  private _eventListeners = new Map<string, EventListener[]>();
564
564
 
565
- addEventListener(type: string, listener: EventListener) {
565
+ addEventListener<T extends Event>(type: string, listener: (evt: T) => any) {
566
566
  this._eventListeners[type] = this._eventListeners[type] || [];
567
567
  this._eventListeners[type].push(listener);
568
568
  }
569
569
 
570
- removeEventListener(type: string, listener: EventListener) {
570
+ removeEventListener<T extends Event>(type: string, listener: (arg: T) => any) {
571
571
  if (!this._eventListeners[type]) return;
572
572
  const index = this._eventListeners[type].indexOf(listener);
573
573
  if (index >= 0) this._eventListeners[type].splice(index, 1);
574
574
  }
575
575
 
576
576
  dispatchEvent(evt: Event): boolean {
577
-
578
577
  if (!this._eventListeners[evt.type]) return false;
579
578
  const listeners = this._eventListeners[evt.type];
580
579
  for (let i = 0; i < listeners.length; i++) {