turbodombuilder - v0.9.48
    Preparing search index...

    Type Alias DataBlockHost<DataType, KeyType, IdType>

    Interface implemented by objects that host a TurboDataBlock. The host receives lifecycle callbacks whenever the block mutates. This allows higher-level structures (such as TurboModels) to react to low-level data changes.

    type DataBlockHost<
        DataType = any,
        KeyType extends string | number | symbol = any,
        IdType extends string | number | symbol = any,
    > = {
        onDirty?: (
            key: KeyType,
            block: TurboDataBlock<DataType, KeyType, IdType>,
        ) => void;
        onChange?: (
            key: KeyType,
            value: unknown,
            block: TurboDataBlock<DataType, KeyType, IdType>,
        ) => void;
    }

    Type Parameters

    • DataType = any

      The type stored in the block.

    • KeyType extends string | number | symbol = any

      The key/index type of entries.

    • IdType extends string | number | symbol = any

      The identifier type of the block.

    Implemented by

    Index

    Properties

    Properties

    onDirty?: (
        key: KeyType,
        block: TurboDataBlock<DataType, KeyType, IdType>,
    ) => void

    Called whenever a key is modified before external callbacks are fired. Useful to mark bound signals as dirty.

    onChange?: (
        key: KeyType,
        value: unknown,
        block: TurboDataBlock<DataType, KeyType, IdType>,
    ) => void

    Called after a change has been committed and callbacks are enabled. Provides the key that changed and its new value.