Skip to content

⬅️ Back to Table of Contents

📄 EventNode.js

📊 Analysis Summary

Metric Count
🔧 Functions 4
🧱 Classes 1
📦 Imports 3

📚 Table of Contents

🛠️ File Location:

📂 src/nodes/utils/EventNode.js

📦 Imports

Name Source
Node ../core/Node.js
NodeUpdateType ../core/constants.js
nodeObject ../tsl/TSLCore.js

Functions

EventNode.update(frame: any): void

Parameters:

  • frame any

Returns: void

Calls:

  • this.callback
Code
update( frame ) {

        this.callback( frame );

    }

createEvent(type: string, callback: Function): EventNode

Parameters:

  • type string
  • callback Function

Returns: EventNode

Calls:

  • nodeObject( new EventNode( type, callback ) ).toStack
Code
( type, callback ) => nodeObject( new EventNode( type, callback ) ).toStack()

OnObjectUpdate(callback: Function): EventNode

Parameters:

  • callback Function

Returns: EventNode

Calls:

  • createEvent
Code
( callback ) => createEvent( EventNode.OBJECT, callback )

OnMaterialUpdate(callback: Function): EventNode

Parameters:

  • callback Function

Returns: EventNode

Calls:

  • createEvent
Code
( callback ) => createEvent( EventNode.MATERIAL, callback )

Classes

EventNode

Class Code
class EventNode extends Node {

    static get type() {

        return 'EventNode';

    }

    /**
     * Creates an EventNode.
     *
     * @param {string} eventType - The type of event
     * @param {Function} callback - The callback to execute on update.
     */
    constructor( eventType, callback ) {

        super( 'void' );

        this.eventType = eventType;
        this.callback = callback;

        if ( eventType === EventNode.OBJECT ) {

            this.updateType = NodeUpdateType.OBJECT;

        } else if ( eventType === EventNode.MATERIAL ) {

            this.updateType = NodeUpdateType.RENDER;

        }

    }

    update( frame ) {

        this.callback( frame );

    }

}

Methods

update(frame: any): void
Code
update( frame ) {

        this.callback( frame );

    }