Function bindUpdate

Calls updater whenever source produces a value. Useful when several fields from a value are needed to update an element.

bindUpdate(source, `#someEl`, (v, el) => {
el.setAttribute(`width`, v.width);
el.setAttribute(`height`, v.height);
});

Returns a PipeDomBinding to manage binding

const b = bindUpdate(...);
b.remove(); // Disconnect binding
b.remove(true); // Disconnect binding and remove element
b.el; // HTML element
  • Type Parameters

    • V

    Parameters

    • source: Reactive<V>
    • elOrQuery: string | HTMLElement
    • updater: ((v: V, el: HTMLElement) => void)
        • (v, el): void
        • Parameters

          • v: V
          • el: HTMLElement

          Returns void

    Returns PipeDomBinding