Created
September 17, 2012 22:05
-
-
Save odoe/3740069 to your computer and use it in GitHub Desktop.
Evented based esri.Map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Because I was bored and wanted to use the foo.on() method with my map | |
define(['dojo/_base/declare', 'dojo/Evented'], function(declare, Evented) { | |
var EventedMap = declare([Evented, esri.Map], { | |
constructor: function() { | |
var _this = this; | |
dojo.connect(this, "onClick", function(event) { | |
return _this.emit("click", event); | |
}); | |
dojo.connect(this, "onDblClick", function(event) { | |
return _this.emit("dblClick", event); | |
}); | |
dojo.connect(this, "onExtentChange", function(extent, delta, levelChange, lod) { | |
return _this.emit("extentChange", extent, delta, levelChange, lod); | |
}); | |
dojo.connect(this, "onKeyDown", function(keyEvent) { | |
return _this.emit("keyDown", keyEvent); | |
}); | |
dojo.connect(this, "onKeyUp", function(keyEvent) { | |
return _this.emit("keyUp", keyEvent); | |
}); | |
dojo.connect(this, "onLayerAdd", function(layer) { | |
return _this.emit("layerAdd", layer); | |
}); | |
dojo.connect(this, "onLayerAddResult", function(layer, error) { | |
return _this.emit("layerAddResult", layer, error); | |
}); | |
dojo.connect(this, "onLayerRemove", function(layer) { | |
return _this.emit("layerRemove", layer); | |
}); | |
dojo.connect(this, "onLayerReorder", function(layer, index) { | |
return _this.emit("layerReorder", layer, index); | |
}); | |
dojo.connect(this, "onLayerResume", function(layer) { | |
return _this.emit("layerResume", layer); | |
}); | |
dojo.connect(this, "onLayersAddResult", function(results) { | |
return _this.emit("layersAddResult", results); | |
}); | |
dojo.connect(this, "onLayersRemoved", function() { | |
return _this.emit("layersRemoved"); | |
}); | |
dojo.connect(this, "onLayersReordered", function(layerIds) { | |
return _this.emit("layersReordered", layerIds); | |
}); | |
dojo.connect(this, "onLayerSuspend", function(layer) { | |
return _this.emit("layerSuspend", layer); | |
}); | |
dojo.connect(this, "onLoad", function(map) { | |
return _this.emit("load", map); | |
}); | |
dojo.connect(this, "onMouseDown", function(event) { | |
return _this.emit("mouseDown", event); | |
}); | |
dojo.connect(this, "onMouseDrag", function(event) { | |
return _this.emit("mouseDrag", event); | |
}); | |
dojo.connect(this, "onMouseDragEnd", function(event) { | |
return _this.emit("mouseDragEnd", event); | |
}); | |
dojo.connect(this, "onMouseDragStart", function(event) { | |
return _this.emit("mouseDragStart", event); | |
}); | |
dojo.connect(this, "onMouseMove", function(event) { | |
return _this.emit("mouseMove", event); | |
}); | |
dojo.connect(this, "onMouseOut", function(event) { | |
return _this.emit("mouseOut", event); | |
}); | |
dojo.connect(this, "onMouseOver", function(event) { | |
return _this.emit("mouseOver", event); | |
}); | |
dojo.connect(this, "onMouseUp", function(event) { | |
return _this.emit("mouseUp", event); | |
}); | |
dojo.connect(this, "onMouseWheel", function(event) { | |
return _this.emit("mouseWheel", event); | |
}); | |
dojo.connect(this, "onPan", function(extent, delta) { | |
return _this.emit("pan", extent, delta); | |
}); | |
dojo.connect(this, "onPanEnd", function(extent, endPoint) { | |
return _this.emit("panEnd", extent, endPoint); | |
}); | |
dojo.connect(this, "onPanStart", function(extent, startPoint) { | |
return _this.emit("panStart", extent, startPoint); | |
}); | |
dojo.connect(this, "onReposition", function(x, y) { | |
return _this.emit("reposition", x, y); | |
}); | |
dojo.connect(this, "onResize", function(extent, width, height) { | |
return _this.emit("resize", extent, width, height); | |
}); | |
dojo.connect(this, "onTimeExtentChange", function(timeExtent) { | |
return _this.emit("timeExtentChange", timeExtent); | |
}); | |
dojo.connect(this, "onUnload", function(map) { | |
return _this.emit("unload", map); | |
}); | |
dojo.connect(this, "onUpdateEnd", function() { | |
return _this.emit("updateEnd"); | |
}); | |
dojo.connect(this, "onUpdateStart", function() { | |
return _this.emit("updateStart"); | |
}); | |
dojo.connect(this, "onZoom", function(extent, zoomFactor, anchor) { | |
return _this.emit("zoom", extent, zoomFactor, anchor); | |
}); | |
dojo.connect(this, "onZoomEnd", function(extent, zoomFactor, anchor) { | |
return _this.emit("zoomEnd", extent, zoomFactor, anchor); | |
}); | |
dojo.connect(this, "onZoomStart", function(extent, zoomFactor, anchor) { | |
return _this.emit("zoomStart", extent, zoomFactor, anchor); | |
}); | |
return this.inherited(arguments); | |
} | |
}); | |
return EventedMap; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment