Class SubscribedEvent<EventTypeID, EventSignal>

An event subscription.

Type Parameters

  • EventTypeID extends SubscribedEventTypeID

    The type ID of the event this subscription is for.

  • EventSignal extends SubscribedEventSignalUnion = EventTypeID extends `${infer TA extends "system" | "world"}.${infer TB extends
        "beforeEvents"
        | "afterEvents"}.${infer TC extends SubscribedEventKeyUnion}`
        ? TC extends keyof (TA extends "system" ? System : World)[TB]
            ? (TA extends "system" ? System : World)[TB][TC]
            : never
        : never

    The type of the event data for the event this subscription is for.

Constructors

Properties

"#eventType": EventTypeID

The type ID of the event this subscription is for.

"#eventTypeLoadedEventsReference": Globals.SubscribedEvent<
    EventTypeID,
    EventSignal,
>[]

A reference to the array of loaded event subscriptions for the event this subscription is for.

"#eventTypeSignalReference": EventSignal

A reference to the event signal for the event this subscription is for.

"#initialized": boolean = false

Whether or not the event subscription has been initialized.

false
"#initializedCallback": (
    arg0: SubscribableEventParameterTypeMap<EventSignal>,
) => void = undefined

The initialized callback function for the event subscription.

undefined

The data for the event subscription.

isSaved: boolean = false

Whether or not the event subscription has been saved.

false

Accessors

  • get creationTime(): number

    The creation time of the event subscription.

    Undefined if the format of the save ID is not recognized.

    Returns number

    undefined
    
  • get eventType(): EventTypeID

    The type ID of the event this subscription is for.

    Returns EventTypeID

  • get eventTypeSignalReference(): EventSignal

    A reference to the event signal for the event this subscription is for.

    Returns EventSignal

  • get initialized(): boolean

    Whether or not the event subscription has been initialized.

    Returns boolean

    false
    
  • get isValid(): boolean

    Whether or not the event subscription is valid.

    True if the event is loaded, false otherwise.

    Returns boolean

  • get lastModified(): number

    The last time the event subscription was modified.

    Returns number

    this.creationTime
    

Methods

  • Deinitializes the event subscription.

    This method unsubscribes the subscription from the actual event.

    Returns boolean

    A boolean representing whether or not the subscription was successfully deinitialized, currently it always returns true, as when it is not successful, an error is thrown.

    This function can't be called in read-only mode.

    This function can be called in early-execution mode.

    If the event subscription callback is not initialized.

    If the event subscription is not initialized.

  • Deletes the event subscription.

    Returns void

    This function can't be called in read-only mode.

    This function can be called in early-execution mode.

    If the event subscription is initialized, it will be deinitialized.

    If the event subscription is loaded, it will be removed from the loaded event subscriptions list.

    If the event subscription is loaded and is saved, it will be removed from the loaded event subscriptions list, then the list of loaded event subscriptions will be saved, causing the event subscription to be deleted.

    If the event subscription is not loaded but is saved, the list of loaded event subscriptions will be saved, causing the event subscription to be deleted.

  • Disables the event subscription.

    Returns boolean

    A boolean representing whether or not the subscription was successfully disabled, if the event is already disabled, false is returned, otherwise true.

  • Enables the event subscription.

    Returns boolean

    A boolean representing whether or not the subscription was successfully enabled, if the event is already enabled, false is returned, otherwise true.

  • Initializes the event subscription.

    This method subscribes the subscription to the actual event.

    Returns true

    A boolean representing whether or not the subscription was successfully initialized, currently it always returns true, as when it is not successful, an error is thrown.

    This function can't be called in read-only mode.

    This function can be called in early-execution mode.

    If the event subscription is disabled.

    If the event subscription callback has already been initialized.

    If the event subscription has already been initialized.

    If the event subscription callback is an empty string.

    If the event subscription callback is not a string.

    If the event subscription callback is not a valid stringified JavaScript function.