Interface ReadonlyBinding<GetType>

The readonly interface for bindings

interface ReadonlyBinding<GetType = any> {
    addChangeListener: (listener: ChangeListener) => ChangeListenerRemover;
    get: () => GetType;
    getChangeUid: () => string;
    id: string;
    isBinding: true;
    isLocked: () => boolean;
    isModified: () => boolean;
    lock: () => () => void;
    triggerChangeListeners: () => void;
    uid: string;
}

Type Parameters

  • GetType = any

Hierarchy (View Summary)

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.

triggerChangeListeners: () => void

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

uid: string

An ID that's unique to this runtime