Imports cased like the filename
This commit is contained in:
41
src/ol/pointer/EventSource.js
Normal file
41
src/ol/pointer/EventSource.js
Normal file
@@ -0,0 +1,41 @@
|
||||
goog.provide('ol.pointer.EventSource');
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.pointer.PointerEventHandler} dispatcher Event handler.
|
||||
* @param {!Object.<string, function(Event)>} mapping Event
|
||||
* mapping.
|
||||
* @constructor
|
||||
*/
|
||||
ol.pointer.EventSource = function(dispatcher, mapping) {
|
||||
/**
|
||||
* @type {ol.pointer.PointerEventHandler}
|
||||
*/
|
||||
this.dispatcher = dispatcher;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @const
|
||||
* @type {!Object.<string, function(Event)>}
|
||||
*/
|
||||
this.mapping_ = mapping;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* List of events supported by this source.
|
||||
* @return {Array.<string>} Event names
|
||||
*/
|
||||
ol.pointer.EventSource.prototype.getEvents = function() {
|
||||
return Object.keys(this.mapping_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the handler that should handle a given event type.
|
||||
* @param {string} eventType The event type.
|
||||
* @return {function(Event)} Handler
|
||||
*/
|
||||
ol.pointer.EventSource.prototype.getHandlerForEvent = function(eventType) {
|
||||
return this.mapping_[eventType];
|
||||
};
|
||||
Reference in New Issue
Block a user