Code coverage report for ol/pointer/eventsource.js

Statements: 91.67% (11 / 12)      Branches: 100% (0 / 0)      Functions: 75% (3 / 4)      Lines: 91.67% (11 / 12)      Ignored: none     

All files » ol/pointer/ » eventsource.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 561   1 1                 1       208             208               1 562                   1                   1 936    
goog.provide('ol.pointer.EventSource');
 
goog.require('goog.events.BrowserEvent');
goog.require('goog.object');
 
 
 
/**
 * @param {ol.pointer.PointerEventHandler} dispatcher
 * @param {Object.<string, function(goog.events.BrowserEvent)>} mapping
 * @constructor
 */
ol.pointer.EventSource = function(dispatcher, mapping) {
  /**
   * @type {ol.pointer.PointerEventHandler}
   */
  this.dispatcher = dispatcher;
 
  /**
   * @private
   * @const
   * @type {Object.<string, function(goog.events.BrowserEvent)>}
   */
  this.mapping_ = mapping;
};
 
 
/**
 * List of events supported by this source.
 * @return {Array.<string>} Event names
 */
ol.pointer.EventSource.prototype.getEvents = function() {
  return goog.object.getKeys(this.mapping_);
};
 
 
/**
 * Returns a mapping between the supported event types and
 * the handlers that should handle an event.
 * @return {Object.<string, function(goog.events.BrowserEvent)>}
 *         Event/Handler mapping
 */
ol.pointer.EventSource.prototype.getMapping = function() {
  return this.mapping_;
};
 
 
/**
 * Returns the handler that should handle a given event type.
 * @param {string} eventType
 * @return {function(goog.events.BrowserEvent)} Handler
 */
ol.pointer.EventSource.prototype.getHandlerForEvent = function(eventType) {
  return this.mapping_[eventType];
};