MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / observe

Method observe

packages/core/ui/gestures/index.ios.ts:104–124  ·  view source on GitHub ↗

* Observes a singular GestureTypes value (e.g. GestureTypes.tap). * * Does not support observing plural GestureTypes values, e.g. * GestureTypes.tap & GestureTypes.doubleTap.

(type: GestureTypes)

Source from the content-addressed store, hash-verified

102 * GestureTypes.tap & GestureTypes.doubleTap.
103 */
104 public observe(type: GestureTypes) {
105 this.type = type;
106
107 if (!this.target) {
108 return;
109 }
110
111 this._onTargetLoaded = () => {
112 this._attach(this.target, type);
113 };
114 this._onTargetUnloaded = () => {
115 this._detach();
116 };
117
118 this.target.on('loaded', this._onTargetLoaded);
119 this.target.on('unloaded', this._onTargetUnloaded);
120
121 if (this.target.isLoaded) {
122 this._attach(this.target, type);
123 }
124 }
125
126 /**
127 * Given a singular GestureTypes value (e.g. GestureTypes.tap), adds a

Callers 1

observeFunction · 0.95

Calls 3

_attachMethod · 0.95
_detachMethod · 0.95
onMethod · 0.65

Tested by

no test coverage detected