modern-canvas 0.3.0 → 0.3.2

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/dist/index.cjs CHANGED
@@ -471,6 +471,9 @@ class CoreObject extends EventEmitter {
471
471
  _changedProperties = /* @__PURE__ */ new Set();
472
472
  _updatingPromise = Promise.resolve();
473
473
  _updating = false;
474
+ is(target) {
475
+ return Boolean(target && this.instanceId === target.instanceId);
476
+ }
474
477
  async _enqueueUpdate() {
475
478
  this._updating = true;
476
479
  try {
@@ -2230,7 +2233,7 @@ class MainLoop extends CoreObject {
2230
2233
  start(process) {
2231
2234
  if (!this._starting) {
2232
2235
  this._starting = true;
2233
- this.removeAllListeners();
2236
+ this.off("process");
2234
2237
  this.on("process", process);
2235
2238
  Ticker.on(this._onNextTick, { sort: 0 });
2236
2239
  }
@@ -5929,13 +5932,13 @@ exports.Node = class Node extends CoreObject {
5929
5932
  }
5930
5933
  setTree(tree) {
5931
5934
  const oldTree = this._tree;
5932
- if (tree !== oldTree) {
5935
+ if (!tree?.is(oldTree)) {
5936
+ if (oldTree) {
5937
+ this.emit("treeExit", oldTree);
5938
+ }
5939
+ this._tree = tree;
5933
5940
  if (tree) {
5934
- this._tree = tree;
5935
5941
  this.emit("treeEnter", tree);
5936
- } else if (oldTree) {
5937
- this.emit("treeExit", oldTree);
5938
- this._tree = tree;
5939
5942
  }
5940
5943
  for (let len = this._children.length, i = 0; i < len; i++) {
5941
5944
  const node = this._children[i];
@@ -6261,9 +6264,6 @@ exports.Node = class Node extends CoreObject {
6261
6264
  });
6262
6265
  return this;
6263
6266
  }
6264
- is(target) {
6265
- return Boolean(target && this.instanceId === target.instanceId);
6266
- }
6267
6267
  /** override */
6268
6268
  _ready() {
6269
6269
  }
package/dist/index.d.cts CHANGED
@@ -162,7 +162,7 @@ declare class EventEmitter {
162
162
  hasEventListener(event: string): boolean;
163
163
  on(type: string, listener: EventListenerValue, options?: EventListenerOptions): any;
164
164
  once(type: string, listener: EventListenerValue): this;
165
- off(type: string, listener: EventListenerValue, options?: EventListenerOptions): this;
165
+ off(type: string, listener?: EventListenerValue, options?: EventListenerOptions): this;
166
166
  emit(type: string, ...args: any[]): boolean;
167
167
  }
168
168
 
@@ -171,7 +171,8 @@ interface CoreObjectEventMap {
171
171
  }
172
172
  interface CoreObject {
173
173
  on: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
174
- off: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
174
+ once: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
175
+ off: (<K extends keyof CoreObjectEventMap>(type: K, listener?: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
175
176
  emit: (<K extends keyof CoreObjectEventMap>(type: K, ...args: Parameters<CoreObjectEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
176
177
  }
177
178
  declare class CoreObject extends EventEmitter {
@@ -181,6 +182,7 @@ declare class CoreObject extends EventEmitter {
181
182
  protected _changedProperties: Set<PropertyKey>;
182
183
  protected _updatingPromise: Promise<void>;
183
184
  protected _updating: boolean;
185
+ is(target: CoreObject | undefined | null): boolean;
184
186
  protected _enqueueUpdate(): Promise<void>;
185
187
  protected _performUpdate(): void;
186
188
  protected _update(changed: Map<PropertyKey, any>): void;
@@ -203,7 +205,8 @@ interface RefCountedEventMap extends CoreObjectEventMap {
203
205
  }
204
206
  interface RefCounted {
205
207
  on: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
206
- off: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
208
+ once: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
209
+ off: (<K extends keyof RefCountedEventMap>(type: K, listener?: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
207
210
  emit: (<K extends keyof RefCountedEventMap>(type: K, ...args: Parameters<RefCountedEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
208
211
  }
209
212
  declare class RefCounted extends CoreObject {
@@ -250,7 +253,8 @@ interface InputEventMap {
250
253
  type InputEventKey = keyof InputEventMap;
251
254
  interface Input {
252
255
  on: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
253
- off: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
256
+ once: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
257
+ off: (<K extends keyof InputEventMap>(type: K, listener?: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
254
258
  emit: (<K extends keyof InputEventMap>(type: K, ...args: Parameters<InputEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
255
259
  }
256
260
  declare class Input extends EventEmitter {
@@ -293,7 +297,8 @@ interface ResourceEventMap extends RefCountedEventMap {
293
297
  }
294
298
  interface Resource {
295
299
  on: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
296
- off: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
300
+ once: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
301
+ off: (<K extends keyof ResourceEventMap>(type: K, listener?: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
297
302
  emit: (<K extends keyof ResourceEventMap>(type: K, ...args: Parameters<ResourceEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
298
303
  }
299
304
  declare class Resource extends RefCounted {
@@ -580,7 +585,8 @@ interface MainLoopEventMap extends CoreObjectEventMap {
580
585
  }
581
586
  interface MainLoop {
582
587
  on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
583
- off: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
588
+ once: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
589
+ off: (<K extends keyof MainLoopEventMap>(type: K, listener?: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
584
590
  emit: (<K extends keyof EventListenerOptions>(type: K, ...args: Parameters<EventListenerOptions[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
585
591
  }
586
592
  declare class MainLoop extends CoreObject {
@@ -1525,7 +1531,8 @@ interface TimelineProperties extends NodeProperties {
1525
1531
  }
1526
1532
  interface Timeline {
1527
1533
  on: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1528
- off: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1534
+ once: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1535
+ off: (<K extends keyof TimelineEventMap>(type: K, listener?: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1529
1536
  emit: (<K extends keyof TimelineEventMap>(type: K, ...args: Parameters<TimelineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1530
1537
  }
1531
1538
  declare class Timeline extends Node {
@@ -1545,7 +1552,8 @@ interface RectangulableEventMap {
1545
1552
  }
1546
1553
  interface Rectangulable {
1547
1554
  on: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1548
- off: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1555
+ once: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1556
+ off: (<K extends keyof RectangulableEventMap>(type: K, listener?: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1549
1557
  emit: (<K extends keyof RectangulableEventMap>(type: K, ...args: Parameters<RectangulableEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1550
1558
  }
1551
1559
  interface Rectangulable {
@@ -1560,7 +1568,8 @@ interface ViewportFramebuffer {
1560
1568
  }
1561
1569
  interface Viewport {
1562
1570
  on: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1563
- off: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1571
+ once: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1572
+ off: (<K extends keyof ViewportEventMap>(type: K, listener?: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1564
1573
  emit: (<K extends keyof ViewportEventMap>(type: K, ...args: Parameters<ViewportEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1565
1574
  }
1566
1575
  declare class Viewport extends Node implements Rectangulable {
@@ -1600,7 +1609,8 @@ interface SceneTreeEventMap extends MainLoopEventMap {
1600
1609
  }
1601
1610
  interface SceneTree {
1602
1611
  on: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1603
- off: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1612
+ once: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1613
+ off: (<K extends keyof SceneTreeEventMap>(type: K, listener?: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1604
1614
  emit: (<K extends keyof SceneTreeEventMap>(type: K, ...args: Parameters<SceneTreeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1605
1615
  }
1606
1616
  declare class SceneTree extends MainLoop {
@@ -1650,6 +1660,7 @@ interface NodeProperties {
1650
1660
  }
1651
1661
  interface Node {
1652
1662
  on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1663
+ once: (<K extends keyof NodeEventMap>(type: K, listener?: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1653
1664
  off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1654
1665
  emit: (<K extends keyof NodeEventMap>(type: K, ...args: Parameters<NodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1655
1666
  }
@@ -1722,7 +1733,6 @@ declare class Node extends CoreObject {
1722
1733
  remove(): void;
1723
1734
  forEach(fn: (child: Node) => void): this;
1724
1735
  deepForEach(fn: (descendant: Node) => void): this;
1725
- is(target: Node | undefined | null): boolean;
1726
1736
  /** override */
1727
1737
  protected _ready(): void;
1728
1738
  protected _treeEnter(tree: SceneTree): void;
@@ -1747,7 +1757,8 @@ interface TimelineNodeEventMap extends NodeEventMap {
1747
1757
  }
1748
1758
  interface TimelineNode {
1749
1759
  on: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1750
- off: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1760
+ once: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1761
+ off: (<K extends keyof TimelineNodeEventMap>(type: K, listener?: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1751
1762
  emit: (<K extends keyof TimelineNodeEventMap>(type: K, ...args: Parameters<TimelineNodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1752
1763
  }
1753
1764
  declare class TimelineNode extends Node {
@@ -1783,7 +1794,8 @@ interface CanvasItemEventMap extends TimelineNodeEventMap {
1783
1794
  }
1784
1795
  interface CanvasItem {
1785
1796
  on: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1786
- off: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1797
+ once: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1798
+ off: (<K extends keyof CanvasItemEventMap>(type: K, listener?: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1787
1799
  emit: (<K extends keyof CanvasItemEventMap>(type: K, ...args: Parameters<CanvasItemEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1788
1800
  }
1789
1801
  declare class CanvasItem extends TimelineNode {
@@ -2557,7 +2569,8 @@ interface ControlProperties extends CanvasItemProperties {
2557
2569
  }
2558
2570
  interface Control {
2559
2571
  on: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2560
- off: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2572
+ once: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2573
+ off: (<K extends keyof ControlEventMap>(type: K, listener?: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2561
2574
  emit: (<K extends keyof ControlEventMap>(type: K, ...args: Parameters<ControlEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2562
2575
  }
2563
2576
  declare class Control extends CanvasItem implements Rectangulable {
@@ -2868,7 +2881,8 @@ interface ScalerProperties extends NodeProperties {
2868
2881
  }
2869
2882
  interface Scaler {
2870
2883
  on: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2871
- off: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2884
+ once: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2885
+ off: (<K extends keyof ScalerEventMap>(type: K, listener?: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2872
2886
  emit: (<K extends keyof ScalerEventMap>(type: K, ...args: Parameters<ScalerEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2873
2887
  }
2874
2888
  declare class Scaler extends Node {
@@ -3024,7 +3038,8 @@ declare const defaultOptions: {
3024
3038
  };
3025
3039
  interface Engine {
3026
3040
  on: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3027
- off: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3041
+ once: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3042
+ off: (<K extends keyof EngineEventMap>(type: K, listener?: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3028
3043
  emit: (<K extends keyof EngineEventMap>(type: K, ...args: Parameters<EngineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
3029
3044
  }
3030
3045
  declare class Engine extends SceneTree {
package/dist/index.d.mts CHANGED
@@ -162,7 +162,7 @@ declare class EventEmitter {
162
162
  hasEventListener(event: string): boolean;
163
163
  on(type: string, listener: EventListenerValue, options?: EventListenerOptions): any;
164
164
  once(type: string, listener: EventListenerValue): this;
165
- off(type: string, listener: EventListenerValue, options?: EventListenerOptions): this;
165
+ off(type: string, listener?: EventListenerValue, options?: EventListenerOptions): this;
166
166
  emit(type: string, ...args: any[]): boolean;
167
167
  }
168
168
 
@@ -171,7 +171,8 @@ interface CoreObjectEventMap {
171
171
  }
172
172
  interface CoreObject {
173
173
  on: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
174
- off: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
174
+ once: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
175
+ off: (<K extends keyof CoreObjectEventMap>(type: K, listener?: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
175
176
  emit: (<K extends keyof CoreObjectEventMap>(type: K, ...args: Parameters<CoreObjectEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
176
177
  }
177
178
  declare class CoreObject extends EventEmitter {
@@ -181,6 +182,7 @@ declare class CoreObject extends EventEmitter {
181
182
  protected _changedProperties: Set<PropertyKey>;
182
183
  protected _updatingPromise: Promise<void>;
183
184
  protected _updating: boolean;
185
+ is(target: CoreObject | undefined | null): boolean;
184
186
  protected _enqueueUpdate(): Promise<void>;
185
187
  protected _performUpdate(): void;
186
188
  protected _update(changed: Map<PropertyKey, any>): void;
@@ -203,7 +205,8 @@ interface RefCountedEventMap extends CoreObjectEventMap {
203
205
  }
204
206
  interface RefCounted {
205
207
  on: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
206
- off: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
208
+ once: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
209
+ off: (<K extends keyof RefCountedEventMap>(type: K, listener?: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
207
210
  emit: (<K extends keyof RefCountedEventMap>(type: K, ...args: Parameters<RefCountedEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
208
211
  }
209
212
  declare class RefCounted extends CoreObject {
@@ -250,7 +253,8 @@ interface InputEventMap {
250
253
  type InputEventKey = keyof InputEventMap;
251
254
  interface Input {
252
255
  on: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
253
- off: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
256
+ once: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
257
+ off: (<K extends keyof InputEventMap>(type: K, listener?: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
254
258
  emit: (<K extends keyof InputEventMap>(type: K, ...args: Parameters<InputEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
255
259
  }
256
260
  declare class Input extends EventEmitter {
@@ -293,7 +297,8 @@ interface ResourceEventMap extends RefCountedEventMap {
293
297
  }
294
298
  interface Resource {
295
299
  on: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
296
- off: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
300
+ once: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
301
+ off: (<K extends keyof ResourceEventMap>(type: K, listener?: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
297
302
  emit: (<K extends keyof ResourceEventMap>(type: K, ...args: Parameters<ResourceEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
298
303
  }
299
304
  declare class Resource extends RefCounted {
@@ -580,7 +585,8 @@ interface MainLoopEventMap extends CoreObjectEventMap {
580
585
  }
581
586
  interface MainLoop {
582
587
  on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
583
- off: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
588
+ once: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
589
+ off: (<K extends keyof MainLoopEventMap>(type: K, listener?: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
584
590
  emit: (<K extends keyof EventListenerOptions>(type: K, ...args: Parameters<EventListenerOptions[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
585
591
  }
586
592
  declare class MainLoop extends CoreObject {
@@ -1525,7 +1531,8 @@ interface TimelineProperties extends NodeProperties {
1525
1531
  }
1526
1532
  interface Timeline {
1527
1533
  on: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1528
- off: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1534
+ once: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1535
+ off: (<K extends keyof TimelineEventMap>(type: K, listener?: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1529
1536
  emit: (<K extends keyof TimelineEventMap>(type: K, ...args: Parameters<TimelineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1530
1537
  }
1531
1538
  declare class Timeline extends Node {
@@ -1545,7 +1552,8 @@ interface RectangulableEventMap {
1545
1552
  }
1546
1553
  interface Rectangulable {
1547
1554
  on: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1548
- off: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1555
+ once: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1556
+ off: (<K extends keyof RectangulableEventMap>(type: K, listener?: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1549
1557
  emit: (<K extends keyof RectangulableEventMap>(type: K, ...args: Parameters<RectangulableEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1550
1558
  }
1551
1559
  interface Rectangulable {
@@ -1560,7 +1568,8 @@ interface ViewportFramebuffer {
1560
1568
  }
1561
1569
  interface Viewport {
1562
1570
  on: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1563
- off: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1571
+ once: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1572
+ off: (<K extends keyof ViewportEventMap>(type: K, listener?: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1564
1573
  emit: (<K extends keyof ViewportEventMap>(type: K, ...args: Parameters<ViewportEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1565
1574
  }
1566
1575
  declare class Viewport extends Node implements Rectangulable {
@@ -1600,7 +1609,8 @@ interface SceneTreeEventMap extends MainLoopEventMap {
1600
1609
  }
1601
1610
  interface SceneTree {
1602
1611
  on: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1603
- off: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1612
+ once: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1613
+ off: (<K extends keyof SceneTreeEventMap>(type: K, listener?: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1604
1614
  emit: (<K extends keyof SceneTreeEventMap>(type: K, ...args: Parameters<SceneTreeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1605
1615
  }
1606
1616
  declare class SceneTree extends MainLoop {
@@ -1650,6 +1660,7 @@ interface NodeProperties {
1650
1660
  }
1651
1661
  interface Node {
1652
1662
  on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1663
+ once: (<K extends keyof NodeEventMap>(type: K, listener?: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1653
1664
  off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1654
1665
  emit: (<K extends keyof NodeEventMap>(type: K, ...args: Parameters<NodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1655
1666
  }
@@ -1722,7 +1733,6 @@ declare class Node extends CoreObject {
1722
1733
  remove(): void;
1723
1734
  forEach(fn: (child: Node) => void): this;
1724
1735
  deepForEach(fn: (descendant: Node) => void): this;
1725
- is(target: Node | undefined | null): boolean;
1726
1736
  /** override */
1727
1737
  protected _ready(): void;
1728
1738
  protected _treeEnter(tree: SceneTree): void;
@@ -1747,7 +1757,8 @@ interface TimelineNodeEventMap extends NodeEventMap {
1747
1757
  }
1748
1758
  interface TimelineNode {
1749
1759
  on: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1750
- off: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1760
+ once: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1761
+ off: (<K extends keyof TimelineNodeEventMap>(type: K, listener?: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1751
1762
  emit: (<K extends keyof TimelineNodeEventMap>(type: K, ...args: Parameters<TimelineNodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1752
1763
  }
1753
1764
  declare class TimelineNode extends Node {
@@ -1783,7 +1794,8 @@ interface CanvasItemEventMap extends TimelineNodeEventMap {
1783
1794
  }
1784
1795
  interface CanvasItem {
1785
1796
  on: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1786
- off: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1797
+ once: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1798
+ off: (<K extends keyof CanvasItemEventMap>(type: K, listener?: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1787
1799
  emit: (<K extends keyof CanvasItemEventMap>(type: K, ...args: Parameters<CanvasItemEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1788
1800
  }
1789
1801
  declare class CanvasItem extends TimelineNode {
@@ -2557,7 +2569,8 @@ interface ControlProperties extends CanvasItemProperties {
2557
2569
  }
2558
2570
  interface Control {
2559
2571
  on: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2560
- off: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2572
+ once: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2573
+ off: (<K extends keyof ControlEventMap>(type: K, listener?: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2561
2574
  emit: (<K extends keyof ControlEventMap>(type: K, ...args: Parameters<ControlEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2562
2575
  }
2563
2576
  declare class Control extends CanvasItem implements Rectangulable {
@@ -2868,7 +2881,8 @@ interface ScalerProperties extends NodeProperties {
2868
2881
  }
2869
2882
  interface Scaler {
2870
2883
  on: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2871
- off: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2884
+ once: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2885
+ off: (<K extends keyof ScalerEventMap>(type: K, listener?: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2872
2886
  emit: (<K extends keyof ScalerEventMap>(type: K, ...args: Parameters<ScalerEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2873
2887
  }
2874
2888
  declare class Scaler extends Node {
@@ -3024,7 +3038,8 @@ declare const defaultOptions: {
3024
3038
  };
3025
3039
  interface Engine {
3026
3040
  on: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3027
- off: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3041
+ once: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3042
+ off: (<K extends keyof EngineEventMap>(type: K, listener?: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3028
3043
  emit: (<K extends keyof EngineEventMap>(type: K, ...args: Parameters<EngineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
3029
3044
  }
3030
3045
  declare class Engine extends SceneTree {
package/dist/index.d.ts CHANGED
@@ -162,7 +162,7 @@ declare class EventEmitter {
162
162
  hasEventListener(event: string): boolean;
163
163
  on(type: string, listener: EventListenerValue, options?: EventListenerOptions): any;
164
164
  once(type: string, listener: EventListenerValue): this;
165
- off(type: string, listener: EventListenerValue, options?: EventListenerOptions): this;
165
+ off(type: string, listener?: EventListenerValue, options?: EventListenerOptions): this;
166
166
  emit(type: string, ...args: any[]): boolean;
167
167
  }
168
168
 
@@ -171,7 +171,8 @@ interface CoreObjectEventMap {
171
171
  }
172
172
  interface CoreObject {
173
173
  on: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
174
- off: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
174
+ once: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
175
+ off: (<K extends keyof CoreObjectEventMap>(type: K, listener?: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
175
176
  emit: (<K extends keyof CoreObjectEventMap>(type: K, ...args: Parameters<CoreObjectEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
176
177
  }
177
178
  declare class CoreObject extends EventEmitter {
@@ -181,6 +182,7 @@ declare class CoreObject extends EventEmitter {
181
182
  protected _changedProperties: Set<PropertyKey>;
182
183
  protected _updatingPromise: Promise<void>;
183
184
  protected _updating: boolean;
185
+ is(target: CoreObject | undefined | null): boolean;
184
186
  protected _enqueueUpdate(): Promise<void>;
185
187
  protected _performUpdate(): void;
186
188
  protected _update(changed: Map<PropertyKey, any>): void;
@@ -203,7 +205,8 @@ interface RefCountedEventMap extends CoreObjectEventMap {
203
205
  }
204
206
  interface RefCounted {
205
207
  on: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
206
- off: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
208
+ once: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
209
+ off: (<K extends keyof RefCountedEventMap>(type: K, listener?: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
207
210
  emit: (<K extends keyof RefCountedEventMap>(type: K, ...args: Parameters<RefCountedEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
208
211
  }
209
212
  declare class RefCounted extends CoreObject {
@@ -250,7 +253,8 @@ interface InputEventMap {
250
253
  type InputEventKey = keyof InputEventMap;
251
254
  interface Input {
252
255
  on: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
253
- off: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
256
+ once: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
257
+ off: (<K extends keyof InputEventMap>(type: K, listener?: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
254
258
  emit: (<K extends keyof InputEventMap>(type: K, ...args: Parameters<InputEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
255
259
  }
256
260
  declare class Input extends EventEmitter {
@@ -293,7 +297,8 @@ interface ResourceEventMap extends RefCountedEventMap {
293
297
  }
294
298
  interface Resource {
295
299
  on: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
296
- off: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
300
+ once: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
301
+ off: (<K extends keyof ResourceEventMap>(type: K, listener?: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
297
302
  emit: (<K extends keyof ResourceEventMap>(type: K, ...args: Parameters<ResourceEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
298
303
  }
299
304
  declare class Resource extends RefCounted {
@@ -580,7 +585,8 @@ interface MainLoopEventMap extends CoreObjectEventMap {
580
585
  }
581
586
  interface MainLoop {
582
587
  on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
583
- off: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
588
+ once: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
589
+ off: (<K extends keyof MainLoopEventMap>(type: K, listener?: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
584
590
  emit: (<K extends keyof EventListenerOptions>(type: K, ...args: Parameters<EventListenerOptions[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
585
591
  }
586
592
  declare class MainLoop extends CoreObject {
@@ -1525,7 +1531,8 @@ interface TimelineProperties extends NodeProperties {
1525
1531
  }
1526
1532
  interface Timeline {
1527
1533
  on: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1528
- off: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1534
+ once: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1535
+ off: (<K extends keyof TimelineEventMap>(type: K, listener?: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1529
1536
  emit: (<K extends keyof TimelineEventMap>(type: K, ...args: Parameters<TimelineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1530
1537
  }
1531
1538
  declare class Timeline extends Node {
@@ -1545,7 +1552,8 @@ interface RectangulableEventMap {
1545
1552
  }
1546
1553
  interface Rectangulable {
1547
1554
  on: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1548
- off: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1555
+ once: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1556
+ off: (<K extends keyof RectangulableEventMap>(type: K, listener?: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1549
1557
  emit: (<K extends keyof RectangulableEventMap>(type: K, ...args: Parameters<RectangulableEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1550
1558
  }
1551
1559
  interface Rectangulable {
@@ -1560,7 +1568,8 @@ interface ViewportFramebuffer {
1560
1568
  }
1561
1569
  interface Viewport {
1562
1570
  on: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1563
- off: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1571
+ once: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1572
+ off: (<K extends keyof ViewportEventMap>(type: K, listener?: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1564
1573
  emit: (<K extends keyof ViewportEventMap>(type: K, ...args: Parameters<ViewportEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1565
1574
  }
1566
1575
  declare class Viewport extends Node implements Rectangulable {
@@ -1600,7 +1609,8 @@ interface SceneTreeEventMap extends MainLoopEventMap {
1600
1609
  }
1601
1610
  interface SceneTree {
1602
1611
  on: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1603
- off: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1612
+ once: (<K extends keyof SceneTreeEventMap>(type: K, listener: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1613
+ off: (<K extends keyof SceneTreeEventMap>(type: K, listener?: SceneTreeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1604
1614
  emit: (<K extends keyof SceneTreeEventMap>(type: K, ...args: Parameters<SceneTreeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1605
1615
  }
1606
1616
  declare class SceneTree extends MainLoop {
@@ -1650,6 +1660,7 @@ interface NodeProperties {
1650
1660
  }
1651
1661
  interface Node {
1652
1662
  on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1663
+ once: (<K extends keyof NodeEventMap>(type: K, listener?: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1653
1664
  off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1654
1665
  emit: (<K extends keyof NodeEventMap>(type: K, ...args: Parameters<NodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1655
1666
  }
@@ -1722,7 +1733,6 @@ declare class Node extends CoreObject {
1722
1733
  remove(): void;
1723
1734
  forEach(fn: (child: Node) => void): this;
1724
1735
  deepForEach(fn: (descendant: Node) => void): this;
1725
- is(target: Node | undefined | null): boolean;
1726
1736
  /** override */
1727
1737
  protected _ready(): void;
1728
1738
  protected _treeEnter(tree: SceneTree): void;
@@ -1747,7 +1757,8 @@ interface TimelineNodeEventMap extends NodeEventMap {
1747
1757
  }
1748
1758
  interface TimelineNode {
1749
1759
  on: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1750
- off: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1760
+ once: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1761
+ off: (<K extends keyof TimelineNodeEventMap>(type: K, listener?: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1751
1762
  emit: (<K extends keyof TimelineNodeEventMap>(type: K, ...args: Parameters<TimelineNodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1752
1763
  }
1753
1764
  declare class TimelineNode extends Node {
@@ -1783,7 +1794,8 @@ interface CanvasItemEventMap extends TimelineNodeEventMap {
1783
1794
  }
1784
1795
  interface CanvasItem {
1785
1796
  on: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1786
- off: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1797
+ once: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1798
+ off: (<K extends keyof CanvasItemEventMap>(type: K, listener?: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
1787
1799
  emit: (<K extends keyof CanvasItemEventMap>(type: K, ...args: Parameters<CanvasItemEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
1788
1800
  }
1789
1801
  declare class CanvasItem extends TimelineNode {
@@ -2557,7 +2569,8 @@ interface ControlProperties extends CanvasItemProperties {
2557
2569
  }
2558
2570
  interface Control {
2559
2571
  on: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2560
- off: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2572
+ once: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2573
+ off: (<K extends keyof ControlEventMap>(type: K, listener?: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2561
2574
  emit: (<K extends keyof ControlEventMap>(type: K, ...args: Parameters<ControlEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2562
2575
  }
2563
2576
  declare class Control extends CanvasItem implements Rectangulable {
@@ -2868,7 +2881,8 @@ interface ScalerProperties extends NodeProperties {
2868
2881
  }
2869
2882
  interface Scaler {
2870
2883
  on: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2871
- off: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2884
+ once: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2885
+ off: (<K extends keyof ScalerEventMap>(type: K, listener?: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
2872
2886
  emit: (<K extends keyof ScalerEventMap>(type: K, ...args: Parameters<ScalerEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
2873
2887
  }
2874
2888
  declare class Scaler extends Node {
@@ -3024,7 +3038,8 @@ declare const defaultOptions: {
3024
3038
  };
3025
3039
  interface Engine {
3026
3040
  on: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3027
- off: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3041
+ once: (<K extends keyof EngineEventMap>(type: K, listener: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3042
+ off: (<K extends keyof EngineEventMap>(type: K, listener?: EngineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
3028
3043
  emit: (<K extends keyof EngineEventMap>(type: K, ...args: Parameters<EngineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
3029
3044
  }
3030
3045
  declare class Engine extends SceneTree {