Trilium Backend API
    Preparing search index...

    Interface NodeEventTarget

    The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API.

    v14.5.0

    interface NodeEventTarget {
        addEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
        addListener(type: string, listener: (arg: any) => void): this;
        dispatchEvent(event: Event): boolean;
        emit(type: string, arg: any): boolean;
        eventNames(): string[];
        getMaxListeners(): number;
        listenerCount(type: string): number;
        off(
            type: string,
            listener: (arg: any) => void,
            options?: EventListenerOptions,
        ): this;
        on(type: string, listener: (arg: any) => void): this;
        once(type: string, listener: (arg: any) => void): this;
        removeAllListeners(type?: string): this;
        removeEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
        removeListener(
            type: string,
            listener: (arg: any) => void,
            options?: EventListenerOptions,
        ): this;
        setMaxListeners(n: number): void;
    }

    Hierarchy

    • EventTarget
      • NodeEventTarget
    Index

    Methods

    • Node.js-specific extension to the EventTarget class that emulates the equivalent EventEmitter API. The only difference between addListener() and addEventListener() is that addListener() will return a reference to the EventTarget.

      Parameters

      • type: string
      • listener: (arg: any) => void

      Returns this

      v14.5.0

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • Node.js-specific extension to the EventTarget class that dispatches the arg to the list of handlers for type.

      Parameters

      • type: string
      • arg: any

      Returns boolean

      true if event listeners registered for the type exist, otherwise false.

      v15.2.0

    • Node.js-specific extension to the EventTarget class that returns an array of event type names for which event listeners are registered.

      Returns string[]

      14.5.0

    • Node.js-specific extension to the EventTarget class that returns the number of max event listeners.

      Returns number

      v14.5.0

    • Node.js-specific extension to the EventTarget class that returns the number of event listeners registered for the type.

      Parameters

      • type: string

      Returns number

      v14.5.0

    • Node.js-specific alias for eventTarget.removeEventListener().

      Parameters

      • type: string
      • listener: (arg: any) => void
      • Optionaloptions: EventListenerOptions

      Returns this

      v14.5.0

    • Node.js-specific alias for eventTarget.addEventListener().

      Parameters

      • type: string
      • listener: (arg: any) => void

      Returns this

      v14.5.0

    • Node.js-specific extension to the EventTarget class that adds a once listener for the given event type. This is equivalent to calling on with the once option set to true.

      Parameters

      • type: string
      • listener: (arg: any) => void

      Returns this

      v14.5.0

    • Node.js-specific extension to the EventTarget class. If type is specified, removes all registered listeners for type, otherwise removes all registered listeners.

      Parameters

      • Optionaltype: string

      Returns this

      v14.5.0

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

      MDN Reference

      Parameters

      Returns void

    • Node.js-specific extension to the EventTarget class that removes the listener for the given type. The only difference between removeListener() and removeEventListener() is that removeListener() will return a reference to the EventTarget.

      Parameters

      • type: string
      • listener: (arg: any) => void
      • Optionaloptions: EventListenerOptions

      Returns this

      v14.5.0

    • Node.js-specific extension to the EventTarget class that sets the number of max event listeners as n.

      Parameters

      • n: number

      Returns void

      v14.5.0