(target: ViewBase, options: BindingOptions)
| 106 | public options: BindingOptions; |
| 107 | |
| 108 | constructor(target: ViewBase, options: BindingOptions) { |
| 109 | this.target = new WeakRef(target); |
| 110 | this.options = options; |
| 111 | this.sourceProperties = getProperties(options.sourceProperty); |
| 112 | this.targetOptions = this.resolveOptions(target, getProperties(options.targetProperty)); |
| 113 | if (!this.targetOptions) { |
| 114 | throw new Error(`Invalid property: ${options.targetProperty} for target: ${target}`); |
| 115 | } |
| 116 | |
| 117 | if (options.twoWay) { |
| 118 | const target = this.targetOptions.instance.get(); |
| 119 | if (target instanceof Observable) { |
| 120 | target.on(`${this.targetOptions.property}Change`, this.onTargetPropertyChanged, this); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | private onTargetPropertyChanged(data: PropertyChangeData): void { |
| 126 | this.updateTwoWay(data.value); |
nothing calls this directly
no test coverage detected