Interface Binding<LeftPropName, RightPropName>

Class for two way binding between bindables.

interface Binding<
    LeftPropName extends PropertyName = string,
    RightPropName extends PropertyName = string,
> {
    bindTo(
        left: Bindable<LeftPropName>,
        right: Bindable<RightPropName>,
    ): this;
    disable(): this;
    enable(): this;
    remove(): this;
    sync(
        leftProperty: LeftPropName | LeftPropName[],
        rightProperty: RightPropName | RightPropName[],
        convertLeftToRight?: ConvertFunction,
        convertRightToLeft?: ConvertFunction,
    ): this;
    syncAll(properties: Partial<Record<LeftPropName, RightPropName>>): this;
    syncAllToLeft(
        properties: Partial<Record<RightPropName, LeftPropName>>,
    ): this;
    syncAllToRight(
        properties: Partial<Record<LeftPropName, RightPropName>>,
    ): this;
    syncToLeft(
        rightProperty: RightPropName | RightPropName[],
        leftProperty: LeftPropName | LeftPropName[],
        convertValue?: ConvertFunction,
    ): this;
    syncToLeftNow(): this;
    syncToRight(
        leftProperty: LeftPropName | LeftPropName[],
        rightProperty: RightPropName | RightPropName[],
        convertValue?: ConvertFunction,
    ): this;
    syncToRightNow(): this;
    unbind(): this;
}

Type Parameters

  • LeftPropName extends PropertyName = string
  • RightPropName extends PropertyName = string

Methods

  • Stop watching for changes on bindables

    Returns this

    Binding.for(esriAccessor, vueComponent).enable().disable();
    
  • Start watching for changes on bindables

    Returns this

    Binding.for(esriAccessor, vueComponent).enable();
    
  • Semantically equivalent to unbind. It is provided to allow simpler registration of cleanups as event handles.

    Returns this

    let dijitWidget= ...
    let binding = Binding.create();
    ...
    // clean up binding if widget is destroyed
    dijitWidget.own(binding);
  • Define properties to be synchronized between two bindables.

    Parameters

    Returns this

    // synchronize between properties with same names
    Binding.for(esriAccessor, vueComponent).syncAll('textField', 'otherTextField');

    // synchronize between properties with different names
    Binding.for(esriAccessor, vueComponent).syncAll({
    'latitude: 'x',
    'longitude: 'y'
    });
  • Define properties to be synchronized between from left to right bindables.

    Parameters

    Returns this

    // synchronize between properties with same names
    Binding.for(esriAccessor, vueComponent).syncAllToLeft('textField', 'otherTextField');

    // synchronize between properties with different names
    Binding.for(esriAccessor, vueComponent).syncAllToLeft({
    'latitude: 'x',
    'longitude: 'y'
    });
  • Define properties to be synchronized between from left to right bindables.

    Parameters

    Returns this

    // synchronize between properties with same names
    Binding.for(esriAccessor, vueComponent).syncAllToRight('textField', 'otherTextField');

    // synchronize between properties with different names
    Binding.for(esriAccessor, vueComponent).syncAllToRight({
    'latitude: 'x',
    'longitude: 'y'
    });
  • Trigger the synchronization of the properties of right to their pedants on left.

    Returns this

  • Trigger the synchronization of the properties of left to their pedants on right.

    Returns this

  • Unbind two models from each other

    Returns this