A subclass of Event that can be (re)used via RecyclableEvent.get and RecyclableEvent.store to avoid garbage collection. If dispatched repeatedly without recycling through get/store, call recycle manually before each dispatch. Exposes some readonly properties of the event class as writable properties for the event system.

Example get/store:

import f = FudgeCore;
const node: f.Node = new f.Node("Node");
const event: f.RecyclableEvent = f.RecyclableEvent.get("myevent", true); // get event from depot
node.dispatchEvent(event);
f.RecyclableEvent.store(event); // store event in depot for reuse

Example manual recycle:

import f = FudgeCore;
const node: f.Node = new f.Node("Node");
const event: f.RecyclableEvent = f.RecyclableEvent.get("myevent", true); // get event and cache it

// called repeatedly, e.g. in a loop
function update(): void {
node.dispatchEvent(event.recycle()); // recycle the event before each dispatch
}

Author

Jonas Plotzky, HFU, 2025

Hierarchy

  • Event
    • RecyclableEvent

Constructors

Properties

path: EventTarget[] = []

Accessors

Methods

  • Emptys the depot of a given type, leaving the events for the garbage collector.

    Parameters

    • _type: string
    • _bubbles: boolean = false
    • _cancelable: boolean = false

    Returns void