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

Method updateOptions

packages/core/ui/core/bindable/index.ts:603–631  ·  view source on GitHub ↗
(options: { instance: WeakRef<any>; property: string }, value: any)

Source from the content-addressed store, hash-verified

601 }
602
603 private updateOptions(options: { instance: WeakRef<any>; property: string }, value: any) {
604 let optionsInstance;
605 if (options && options.instance) {
606 optionsInstance = options.instance.get();
607 }
608
609 if (!optionsInstance) {
610 return;
611 }
612
613 this.updating = true;
614
615 try {
616 if (isEventOrGesture(options.property, <any>optionsInstance) && types.isFunction(value)) {
617 // Calling Observable.prototype.off() with just the event name will
618 // remove all handlers under that event name.
619 optionsInstance.off(options.property);
620 optionsInstance.on(options.property, value, optionsInstance.bindingContext);
621 } else if (optionsInstance instanceof Observable) {
622 optionsInstance.set(options.property, value);
623 } else {
624 optionsInstance[options.property] = value;
625 }
626 } catch (ex) {
627 Trace.write('Binding error while setting property ' + options.property + ' of ' + optionsInstance + ': ' + ex, Trace.categories.Binding, Trace.messageType.error);
628 }
629
630 this.updating = false;
631 }
632}

Callers 2

updateTargetMethod · 0.95
updateSourceMethod · 0.95

Calls 6

isEventOrGestureFunction · 0.85
getMethod · 0.65
offMethod · 0.65
onMethod · 0.65
writeMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected