(element = null, options)
| 92255 | }; |
| 92256 | class EventManager { |
| 92257 | constructor(element = null, options){ |
| 92258 | /** |
| 92259 | * Handle basic events using the 'hammer.input' Hammer.js API: |
| 92260 | * Before running Recognizers, Hammer emits a 'hammer.input' event |
| 92261 | * with the basic event info. This function emits all basic events |
| 92262 | * aliased to the "class" of event received. |
| 92263 | * See constants.BASIC_EVENT_CLASSES basic event class definitions. |
| 92264 | */ this._onBasicInput = (event)=>{ |
| 92265 | const { srcEvent } = event; |
| 92266 | const alias = (0, _constants.BASIC_EVENT_ALIASES)[srcEvent.type]; |
| 92267 | if (alias) // fire all events aliased to srcEvent.type |
| 92268 | this.manager.emit(alias, event); |
| 92269 | }; |
| 92270 | /** |
| 92271 | * Handle events not supported by Hammer.js, |
| 92272 | * and pipe back out through same (Hammer) channel used by other events. |
| 92273 | */ this._onOtherEvent = (event)=>{ |
| 92274 | // console.log('onotherevent', event.type, event) |
| 92275 | this.manager.emit(event.type, event); |
| 92276 | }; |
| 92277 | this.options = { |
| 92278 | ...DEFAULT_OPTIONS, |
| 92279 | ...options |
| 92280 | }; |
| 92281 | this.events = new Map(); |
| 92282 | this.setElement(element); |
| 92283 | // Register all passed events. |
| 92284 | const { events } = this.options; |
| 92285 | if (events) this.on(events); |
| 92286 | } |
| 92287 | getElement() { |
| 92288 | return this.element; |
| 92289 | } |
nothing calls this directly
no test coverage detected