* Observes a singular GestureTypes value (e.g. GestureTypes.tap). * * Does not support observing plural GestureTypes values, e.g. * GestureTypes.tap & GestureTypes.doubleTap.
(type: GestureTypes)
| 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 |