turbodombuilder - v0.9.48
    Preparing search index...

    Type Alias TurboObserverProperties<DataType, ComponentType, KeyType, BlockKeyType>

    Configuration object to create a new TurboObserver.

    type TurboObserverProperties<
        DataType = any,
        ComponentType extends object = any,
        KeyType extends string | number | symbol = string,
        BlockKeyType extends string | number = string,
    > = {
        customConstructor?: new (
            ...args: any[],
        ) => TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>;
        initialize?: boolean;
        onAdded?: (
            data: DataType,
            id: KeyType,
            self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
            blockKey?: BlockKeyType,
        ) => ComponentType | void;
        onUpdated?: (
            data: DataType,
            instance: ComponentType,
            id: KeyType,
            self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
            blockKey?: BlockKeyType,
        ) => void;
        onDeleted?: (
            data: DataType,
            instance: ComponentType,
            id: KeyType,
            self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
            blockKey?: BlockKeyType,
        ) => void;
        onInitialize?: (
            self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
        ) => void;
        onDestroy?: (
            self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
        ) => void;
    }

    Type Parameters

    • DataType = any

      The type of data handled by the observer.

    • ComponentType extends object = any

      The instance type created/managed by the observer.

    • KeyType extends string | number | symbol = string

      The per-item key type.

    • BlockKeyType extends string | number = string

      The block-grouping key type.

    Index

    Properties

    customConstructor?: new (
        ...args: any[],
    ) => TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>

    Optional custom observer constructor to instantiate instead of the default TurboObserver.

    initialize?: boolean

    If true, the observer is initialized immediately.

    onAdded?: (
        data: DataType,
        id: KeyType,
        self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
        blockKey?: BlockKeyType,
    ) => ComponentType | void

    Called when a new item appears.

    onUpdated?: (
        data: DataType,
        instance: ComponentType,
        id: KeyType,
        self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
        blockKey?: BlockKeyType,
    ) => void

    Called when an existing item changes.

    onDeleted?: (
        data: DataType,
        instance: ComponentType,
        id: KeyType,
        self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
        blockKey?: BlockKeyType,
    ) => void

    Called when an item is deleted.

    onInitialize?: (
        self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
    ) => void

    Called when the observer is initialized.

    onDestroy?: (
        self: TurboObserver<DataType, ComponentType, KeyType, BlockKeyType>,
    ) => void

    Called when the observer is destroyed.