UNPKG

hd-utils

Version:

A handy utils for modern JS developers

24 lines (22 loc) 736 B
/** * @description give the ability to create two-way data binding without any js library. * @example * const inputElement = document.getElementById('textInput') as HTMLInputElement; const outputElement = document.getElementById('textDisplay') as HTMLElement; const binder = new TwoWayBinder( inputElement, outputElement ); */ export default class TwoWayBinder { private inputElement; private outputElement; private eventType; constructor(inputElement: HTMLInputElement, outputElement: HTMLElement, eventType?: string); private onInputChanged; private updateElements; updateInput(): void; updateOutput(): void; get value(): string; set value(newValue: string); }