Skip to content

Commit

Permalink
Support overriding default recognizers. (#656) (#696)
Browse files Browse the repository at this point in the history
* Support overriding default recognizers. (#656)

* Try that again.
  • Loading branch information
ericsoco authored and Shaojing Li committed Jun 9, 2017
1 parent a8a8e4e commit 8aa80dd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/utils/events/event-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@ const {
* @param {DOM Element} element DOM element on which event handlers will be registered.
* @param {Object} options Options for instantiation
* @param {Object} options.events Map of {event name: handler} to register on init.
* @param {Object} options.recognizers Gesture recognizers from Hammer.js to register.
* Not yet implemented.
* @param {Object} options.recognizers Gesture recognizers from Hammer.js to register,
* as an Array in Hammer.Recognizer format.
* (http://hammerjs.github.io/api/#hammermanager)
*/
export default class EventManager {
constructor(element, options) {
// TODO: support overriding default RECOGNIZERS by passing
// recognizers / configs, keyed to event name.

constructor(element, options = {}) {
this.element = element;
this._onBasicInput = this._onBasicInput.bind(this);
this.manager = new Manager(element, {recognizers: RECOGNIZERS})
this.manager = new Manager(element, {recognizers: options.recognizers || RECOGNIZERS})
.on('hammer.input', this._onBasicInput);

this.aliasedEventHandlerCounts = {};
Expand Down

0 comments on commit 8aa80dd

Please sign in to comment.