react-bindings
    Preparing search index...

    Interface Binding<GetType>

    A binding is a stored piece of data that notifies registered listeners when changed.

    useBinding

    interface Binding<GetType = any> {
        addChangeListener: (listener: ChangeListener) => ChangeListenerRemover;
        get: () => GetType;
        getChangeUid: () => string;
        id: string;
        isBinding: true;
        isLocked: () => boolean;
        isModified: () => boolean;
        lock: () => () => void;
        reset: () => void;
        set: (newValue: GetType) => void;
        setIsModified: (isModified: boolean) => void;
        setRaw: (newValue: GetType) => void;
        setValueTransformer?: SetValueTransformer<GetType>;
        triggerChangeListeners: () => void;
        uid: string;
    }

    Type Parameters

    • GetType = any

    Hierarchy (View Summary)

    Index

    Properties

    addChangeListener: (listener: ChangeListener) => ChangeListenerRemover

    Adds a listener that will be called when this binding changes.

    Type declaration

    useBindingEffect and BindingsConsumer

    get: () => GetType

    Type declaration

    getChangeUid: () => string

    Every time the value is changed, the change uid is updated

    id: string

    A technical, but human-readable ID, which isn't guaranteed to be unique

    isBinding: true

    A marker indicating that this is a binding type

    isLocked: () => boolean

    Type declaration

      • (): boolean
      • Returns boolean

        true if the binding is locked

    isModified: () => boolean

    Type declaration

      • (): boolean
      • Returns boolean

        true if this binding has been marked as being modified

    lock: () => () => void

    Increments the lock count and returns a method to decrement it. A binding is locked if its lock count is > 0. When a binding is locked, mutating calls (reset/set/setRaw) won't have an immediate effect. However, if a mutating call is made on a locked binding, the change will be applied once the binding becomes unlocked.

    Type declaration

      • (): () => void
      • Returns () => void

        a function for decrementing this binding's lock count.

    reset: () => void

    Resets the binding back to its initial value and marks the binding as non-modified.

    set: (newValue: GetType) => void

    Sets the value, using the result of setValueTransformer if set, and then marks the binding as modified.

    setIsModified: (isModified: boolean) => void

    Sets the binding as having been modified or not

    setRaw: (newValue: GetType) => void

    Sets the internal value without transforming or marking as changed. Don't normally use this!

    setValueTransformer?: SetValueTransformer<GetType>

    If set, a function to transform the value before it's stored

    triggerChangeListeners: () => void

    Forcibly triggers the change listeners. Don't normally use this!

    uid: string

    An ID that's unique to this runtime