x4js - v2.2.49
    Preparing search index...

    Class DataStore<T>

    Type Parameters

    • T = any

    Hierarchy (View Summary)

    Index
    m_fields: FieldInfo[]
    m_model: DataModel<T>
    m_proxy: DataProxy
    m_rec_index: DataIndex
    m_records: DataRecord<T>[]
    • Registers an event listener for a specific event name.

      Type Parameters

      • K extends "data_change"

      Parameters

      • name: K

        The name of the event to listen for (must be a key in E).

      • callback: (ev: DataStoreEventMap[K]) => void

        The function to be called when the event is fired.

      • capturing: boolean = false

        If true, the listener will be added to the beginning of the listener list (capturing phase).

      Returns () => void

    • Dispatches an event with a given name and payload to all registered listeners.

      Type Parameters

      • K extends "data_change"

      Parameters

      • name: K

        The name of the event to fire (must be a key in E).

      • evx: DataStoreEventMap[K]

        The event payload (event object) to pass to the listeners.

      Returns void

    • find the index of the element with the given id

      Parameters

      • id: any

      Returns number

    • Removes a previously registered event listener.

      Type Parameters

      • K extends "data_change"

      Parameters

      • name: K

        The name of the event from which to remove the listener.

      • callback: (ev: DataStoreEventMap[K]) => any

        The specific callback function to remove. It must be the same function instance that was originally registered.

      Returns void

    • convert raw objects to real records from model

      Parameters

      • records: any[]

      Returns void