MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / constructor

Method constructor

packages/core/ui/core/bindable/index.ts:108–123  ·  view source on GitHub ↗
(target: ViewBase, options: BindingOptions)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 4

resolveOptionsMethod · 0.95
getPropertiesFunction · 0.85
getMethod · 0.65
onMethod · 0.65

Tested by

no test coverage detected