From 501b42228ab12d50f06d8f000dac5078aaca9509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Junod?= Date: Sat, 17 Sep 2011 19:09:40 +0000 Subject: [PATCH] remove event type list from Events (lazy listener initialization) p=tschaub,me r=erilem (closes #2555) git-svn-id: http://svn.openlayers.org/trunk/openlayers@12384 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control.js | 7 +- lib/OpenLayers/Control/DrawFeature.js | 10 -- lib/OpenLayers/Control/Geolocate.js | 11 --- lib/OpenLayers/Control/GetFeature.js | 11 --- lib/OpenLayers/Control/Measure.js | 10 +- lib/OpenLayers/Control/SLDSelect.js | 10 +- lib/OpenLayers/Control/SelectFeature.js | 8 -- lib/OpenLayers/Control/Snapping.js | 9 +- lib/OpenLayers/Control/Split.js | 9 +- lib/OpenLayers/Control/TransformFeature.js | 9 -- lib/OpenLayers/Control/WMSGetFeatureInfo.js | 9 -- lib/OpenLayers/Control/WMTSGetFeatureInfo.js | 9 -- lib/OpenLayers/Events.js | 98 +++++++------------- lib/OpenLayers/Layer.js | 9 +- lib/OpenLayers/Layer/Vector.js | 18 +--- lib/OpenLayers/Map.js | 13 +-- lib/OpenLayers/Marker.js | 2 +- lib/OpenLayers/Marker/Box.js | 2 +- lib/OpenLayers/Request.js | 2 +- lib/OpenLayers/Strategy/Save.js | 8 +- lib/OpenLayers/Tile.js | 10 +- tests/Control/DrawFeature.html | 4 +- tests/Events.html | 93 +++++-------------- tests/Layer/Grid.html | 7 +- tests/Layer/Text.html | 2 +- 25 files changed, 85 insertions(+), 295 deletions(-) diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js index e61d1cd041..b79ec2dc73 100644 --- a/lib/OpenLayers/Control.js +++ b/lib/OpenLayers/Control.js @@ -145,9 +145,7 @@ OpenLayers.Control = OpenLayers.Class({ events: null, /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: + * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) @@ -165,7 +163,6 @@ OpenLayers.Control = OpenLayers.Class({ * activate - Triggered when activated. * deactivate - Triggered when deactivated. */ - EVENT_TYPES: ["activate", "deactivate"], /** * Constructor: OpenLayers.Control @@ -187,7 +184,7 @@ OpenLayers.Control = OpenLayers.Class({ OpenLayers.Util.extend(this, options); - this.events = new OpenLayers.Events(this, null, this.EVENT_TYPES); + this.events = new OpenLayers.Events(this); if(this.eventListeners instanceof Object) { this.events.on(this.eventListeners); } diff --git a/lib/OpenLayers/Control/DrawFeature.js b/lib/OpenLayers/Control/DrawFeature.js index eb843293f5..8d4a11136f 100644 --- a/lib/OpenLayers/Control/DrawFeature.js +++ b/lib/OpenLayers/Control/DrawFeature.js @@ -32,12 +32,9 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, { callbacks: null, /** - * Constant: EVENT_TYPES - * * Supported event types: * featureadded - Triggered when a feature is added */ - EVENT_TYPES: ["featureadded"], /** * APIProperty: multi @@ -67,13 +64,6 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, { * options - {Object} */ initialize: function(layer, handler, options) { - - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - OpenLayers.Control.prototype.initialize.apply(this, [options]); this.callbacks = OpenLayers.Util.extend( { diff --git a/lib/OpenLayers/Control/Geolocate.js b/lib/OpenLayers/Control/Geolocate.js index 6745ab7595..6a2badb8fc 100644 --- a/lib/OpenLayers/Control/Geolocate.js +++ b/lib/OpenLayers/Control/Geolocate.js @@ -23,14 +23,12 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, { /** - * Constant: EVENT_TYPES * Supported event types: * - *locationupdated* Triggered when browser return a new position * - *locationfailed* Triggered when geolocation has failed * - *locationuncapable* Triggered when control is activated on a browser * which doesn't support geolocation */ - EVENT_TYPES: ["locationupdated", "locationfailed", "locationuncapable"], /** * Property: geolocation @@ -63,15 +61,6 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, { * Create a new control to deal with browser geolocation API * */ - initialize: function(options) { - // concatenate events specific to this control with those from the base - this.EVENT_TYPES = - OpenLayers.Control.Geolocate.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - this.geolocationOptions = {}; - OpenLayers.Control.prototype.initialize.apply(this, [options]); - }, /** * Method: destroy diff --git a/lib/OpenLayers/Control/GetFeature.js b/lib/OpenLayers/Control/GetFeature.js index ee2896db13..c6e223b357 100644 --- a/lib/OpenLayers/Control/GetFeature.js +++ b/lib/OpenLayers/Control/GetFeature.js @@ -170,8 +170,6 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { filterType: OpenLayers.Filter.Spatial.BBOX, /** - * Constant: EVENT_TYPES - * * Supported event types: * beforefeatureselected - Triggered when is true before a * feature is selected. The event object has a feature property with @@ -197,9 +195,6 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { * outfeature - Triggered when is true and the mouse moves * moved away from a hover-selected feature */ - EVENT_TYPES: ["featureselected", "featuresselected", "featureunselected", - "clickout", "beforefeatureselected", "beforefeaturesselected", - "hoverfeature", "outfeature"], /** * Constructor: OpenLayers.Control.GetFeature @@ -211,12 +206,6 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { * made) */ initialize: function(options) { - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Control.GetFeature.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - options.handlerOptions = options.handlerOptions || {}; OpenLayers.Control.prototype.initialize.apply(this, [options]); diff --git a/lib/OpenLayers/Control/Measure.js b/lib/OpenLayers/Control/Measure.js index 172317c1ad..f57f6c4465 100644 --- a/lib/OpenLayers/Control/Measure.js +++ b/lib/OpenLayers/Control/Measure.js @@ -18,9 +18,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, { /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: + * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) @@ -37,7 +35,6 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, { * measurement sketch is modified. Listeners receive an event with measure, * units, order, and geometry. */ - EVENT_TYPES: ['measure', 'measurepartial'], /** * APIProperty: handlerOptions @@ -120,11 +117,6 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, { * options - {Object} */ initialize: function(handler, options) { - // concatenate events specific to measure with those from the base - this.EVENT_TYPES = - OpenLayers.Control.Measure.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); OpenLayers.Control.prototype.initialize.apply(this, [options]); var callbacks = {done: this.measureComplete, point: this.measurePartial}; diff --git a/lib/OpenLayers/Control/SLDSelect.js b/lib/OpenLayers/Control/SLDSelect.js index 7bb7574bf9..571f3e28c2 100644 --- a/lib/OpenLayers/Control/SLDSelect.js +++ b/lib/OpenLayers/Control/SLDSelect.js @@ -24,9 +24,7 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, { /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: + * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) @@ -41,7 +39,6 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, { * array of OpenLayers.Filter objects created in order to perform * the particular selection. */ - EVENT_TYPES: ["selected"], /** * APIProperty: clearOnDeactivate @@ -148,11 +145,6 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, { * selection on. */ initialize: function(handler, options) { - // concatenate events specific to this control with those from the base - this.EVENT_TYPES = - OpenLayers.Control.SLDSelect.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); OpenLayers.Control.prototype.initialize.apply(this, [options]); this.callbacks = OpenLayers.Util.extend({done: this.select, diff --git a/lib/OpenLayers/Control/SelectFeature.js b/lib/OpenLayers/Control/SelectFeature.js index 5d2dc9319c..1d93238a4c 100644 --- a/lib/OpenLayers/Control/SelectFeature.js +++ b/lib/OpenLayers/Control/SelectFeature.js @@ -22,14 +22,11 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, { /** - * Constant: EVENT_TYPES - * * Supported event types: * - *beforefeaturehighlighted* Triggered before a feature is highlighted * - *featurehighlighted* Triggered when a feature is highlighted * - *featureunhighlighted* Triggered when a feature is unhighlighted */ - EVENT_TYPES: ["beforefeaturehighlighted", "featurehighlighted", "featureunhighlighted"], /** * Property: multipleKey @@ -173,11 +170,6 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, { * options - {Object} */ initialize: function(layers, options) { - // concatenate events specific to this control with those from the base - this.EVENT_TYPES = - OpenLayers.Control.SelectFeature.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); OpenLayers.Control.prototype.initialize.apply(this, [options]); if(this.scope === null) { diff --git a/lib/OpenLayers/Control/Snapping.js b/lib/OpenLayers/Control/Snapping.js index 13edf839a7..525d119481 100644 --- a/lib/OpenLayers/Control/Snapping.js +++ b/lib/OpenLayers/Control/Snapping.js @@ -18,9 +18,7 @@ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, { /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: + * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) @@ -45,7 +43,6 @@ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, { * unsnap - Triggered when a vertex is unsnapped. Listeners receive an * event with a *point* property. */ - EVENT_TYPES: ["beforesnap", "snap", "unsnap"], /** * CONSTANT: DEFAULTS @@ -175,10 +172,6 @@ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, { * no maximum resolution limit. */ initialize: function(options) { - // concatenate events specific to measure with those from the base - Array.prototype.push.apply( - this.EVENT_TYPES, OpenLayers.Control.prototype.EVENT_TYPES - ); OpenLayers.Control.prototype.initialize.apply(this, [options]); this.options = options || {}; // TODO: this could be done by the super diff --git a/lib/OpenLayers/Control/Split.js b/lib/OpenLayers/Control/Split.js index 3dd823c1ba..fa54aa8f91 100644 --- a/lib/OpenLayers/Control/Split.js +++ b/lib/OpenLayers/Control/Split.js @@ -19,9 +19,7 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, { /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: + * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) @@ -47,7 +45,6 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, { * sketch or modified feature used as a splitter. The features * property is a list of all resulting features. */ - EVENT_TYPES: ["beforesplit", "split", "aftersplit"], /** * APIProperty: layer @@ -169,10 +166,6 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, { * splitting. */ initialize: function(options) { - // concatenate events specific to measure with those from the base - Array.prototype.push.apply( - this.EVENT_TYPES, OpenLayers.Control.prototype.EVENT_TYPES - ); OpenLayers.Control.prototype.initialize.apply(this, [options]); this.options = options || {}; // TODO: this could be done by the super diff --git a/lib/OpenLayers/Control/TransformFeature.js b/lib/OpenLayers/Control/TransformFeature.js index 42faff7fea..437124bfcf 100644 --- a/lib/OpenLayers/Control/TransformFeature.js +++ b/lib/OpenLayers/Control/TransformFeature.js @@ -22,8 +22,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, { /** - * Constant: EVENT_TYPES - * * Supported event types: * - *beforesetfeature* Triggered before a feature is set for * tranformation. The feature will not be set if a listener returns @@ -51,8 +49,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, { * - *transformcomplete* Triggered after dragging. Listeners receive * an event object with the transformed *feature*. */ - EVENT_TYPES: ["beforesetfeature", "setfeature", "beforetransform", - "transform", "transformcomplete"], /** * APIProperty: geometryTypes @@ -181,11 +177,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, { * control. */ initialize: function(layer, options) { - // concatenate events specific to this control with those from the base - this.EVENT_TYPES = - OpenLayers.Control.TransformFeature.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); OpenLayers.Control.prototype.initialize.apply(this, [options]); this.layer = layer; diff --git a/lib/OpenLayers/Control/WMSGetFeatureInfo.js b/lib/OpenLayers/Control/WMSGetFeatureInfo.js index f0a21883cd..9b89bae9db 100644 --- a/lib/OpenLayers/Control/WMSGetFeatureInfo.js +++ b/lib/OpenLayers/Control/WMSGetFeatureInfo.js @@ -155,8 +155,6 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { hoverRequest: null, /** - * Constant: EVENT_TYPES - * * Supported event types (in addition to those from ): * beforegetfeatureinfo - Triggered before the request is sent. * The event object has an *xy* property with the position of the @@ -172,7 +170,6 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { * layers, *text* and *request* will only contain the response body * and request object of the last request. */ - EVENT_TYPES: ["beforegetfeatureinfo", "nogetfeatureinfo", "getfeatureinfo"], /** * Constructor: @@ -181,12 +178,6 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { * options - {Object} */ initialize: function(options) { - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Control.WMSGetFeatureInfo.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - options = options || {}; options.handlerOptions = options.handlerOptions || {}; diff --git a/lib/OpenLayers/Control/WMTSGetFeatureInfo.js b/lib/OpenLayers/Control/WMTSGetFeatureInfo.js index ec62eeabff..4b063fea71 100644 --- a/lib/OpenLayers/Control/WMTSGetFeatureInfo.js +++ b/lib/OpenLayers/Control/WMTSGetFeatureInfo.js @@ -136,8 +136,6 @@ OpenLayers.Control.WMTSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { hoverRequest: null, /** - * Constant: EVENT_TYPES - * * Supported event types (in addition to those from ): * beforegetfeatureinfo - Triggered before each request is sent. * The event object has an *xy* property with the position of the @@ -157,7 +155,6 @@ OpenLayers.Control.WMTSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { * an event with *request*, *xy*, and *layer* properties. In the case * of a parsing error, the event will also contain an *error* property. */ - EVENT_TYPES: ["beforegetfeatureinfo", "getfeatureinfo", "exception"], /** * Property: pending @@ -172,12 +169,6 @@ OpenLayers.Control.WMTSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { * options - {Object} */ initialize: function(options) { - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Control.WMTSGetFeatureInfo.prototype.EVENT_TYPES.concat( - OpenLayers.Control.prototype.EVENT_TYPES - ); - options = options || {}; options.handlerOptions = options.handlerOptions || {}; diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 69769c3244..48aaeae7eb 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -419,12 +419,6 @@ OpenLayers.Events = OpenLayers.Class({ */ element: null, - /** - * Property: eventTypes - * {Array(String)} list of support application events - */ - eventTypes: null, - /** * Property: eventHandler * {Function} bound event handler attached to elements @@ -480,7 +474,9 @@ OpenLayers.Events = OpenLayers.Class({ * Parameters: * object - {Object} The js object to which this Events object is being added * element - {DOMElement} A dom element to respond to browser events - * eventTypes - {Array(String)} Array of custom application events + * eventTypes - {Array(String)} Deprecated. Array of custom application + * events. A listener may be registered for any named event, regardless + * of the values provided here. * fallThrough - {Boolean} Allow events to fall through after these have * been handled? * options - {Object} Options for the events object. @@ -490,30 +486,20 @@ OpenLayers.Events = OpenLayers.Class({ this.object = object; this.fallThrough = fallThrough; this.listeners = {}; - - // keep a bound copy of handleBrowserEvent() so that we can - // pass the same function to both Event.observe() and .stopObserving() - this.eventHandler = OpenLayers.Function.bindAsEventListener( - this.handleBrowserEvent, this - ); - - // to be used with observe and stopObserving - this.clearMouseListener = OpenLayers.Function.bind( - this.clearMouseCache, this - ); - - // if eventTypes is specified, create a listeners list for each - // custom application event. - this.eventTypes = []; - if (eventTypes != null) { - for (var i=0, len=eventTypes.length; i} A new vector layer */ initialize: function(name, options) { - - // concatenate events specific to vector with those from the base - this.EVENT_TYPES = - OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat( - OpenLayers.Layer.prototype.EVENT_TYPES - ); - OpenLayers.Layer.prototype.initialize.apply(this, arguments); // allow user-set renderer, otherwise assign one diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 285ae0c60c..cad15bf620 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -36,9 +36,7 @@ OpenLayers.Map = OpenLayers.Class({ }, /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: + * Register a listener for a particular event with the following syntax: * (code) * map.events.register(type, obj, listener); * (end) @@ -85,13 +83,6 @@ OpenLayers.Map = OpenLayers.Class({ * - *mousemove* triggered after mousemove the map * - *changebaselayer* triggered after the base layer changes */ - EVENT_TYPES: [ - "preaddlayer", "addlayer","preremovelayer", "removelayer", - "changelayer", "movestart", - "move", "moveend", "zoomend", "popupopen", "popupclose", - "addmarker", "removemarker", "clearmarkers", "mouseover", - "mouseout", "mousemove", "dragstart", "drag", "dragend", - "changebaselayer"], /** * Property: id @@ -538,7 +529,7 @@ OpenLayers.Map = OpenLayers.Class({ this.viewPortDiv.appendChild(eventsDiv); this.eventsDiv = eventsDiv; this.events = new OpenLayers.Events( - this, this.eventsDiv, this.EVENT_TYPES, this.fallThrough, + this, this.eventsDiv, null, this.fallThrough, {includeXY: true} ); diff --git a/lib/OpenLayers/Marker.js b/lib/OpenLayers/Marker.js index c3debf8e42..6c93aaefe6 100644 --- a/lib/OpenLayers/Marker.js +++ b/lib/OpenLayers/Marker.js @@ -80,7 +80,7 @@ OpenLayers.Marker = OpenLayers.Class({ this.icon.offset = newIcon.offset; this.icon.calculateOffset = newIcon.calculateOffset; } - this.events = new OpenLayers.Events(this, this.icon.imageDiv, null); + this.events = new OpenLayers.Events(this, this.icon.imageDiv); }, /** diff --git a/lib/OpenLayers/Marker/Box.js b/lib/OpenLayers/Marker/Box.js index 74cd95a93e..502b1bcdf2 100644 --- a/lib/OpenLayers/Marker/Box.js +++ b/lib/OpenLayers/Marker/Box.js @@ -40,7 +40,7 @@ OpenLayers.Marker.Box = OpenLayers.Class(OpenLayers.Marker, { this.bounds = bounds; this.div = OpenLayers.Util.createDiv(); this.div.style.overflow = 'hidden'; - this.events = new OpenLayers.Events(this, this.div, null); + this.events = new OpenLayers.Events(this, this.div); this.setBorder(borderColor, borderWidth); }, diff --git a/lib/OpenLayers/Request.js b/lib/OpenLayers/Request.js index 4c6578b158..6c00d5af77 100644 --- a/lib/OpenLayers/Request.js +++ b/lib/OpenLayers/Request.js @@ -57,7 +57,7 @@ OpenLayers.Request = { * success - Triggered when the HTTP response has a success code (200-299). * failure - Triggered when the HTTP response does not have a success code. */ - events: new OpenLayers.Events(this, null, ["complete", "success", "failure"]), + events: new OpenLayers.Events(this), /** * APIMethod: issue diff --git a/lib/OpenLayers/Strategy/Save.js b/lib/OpenLayers/Strategy/Save.js index 5efae29570..9315277e11 100644 --- a/lib/OpenLayers/Strategy/Save.js +++ b/lib/OpenLayers/Strategy/Save.js @@ -20,19 +20,17 @@ OpenLayers.Strategy.Save = OpenLayers.Class(OpenLayers.Strategy, { /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types. Register a listener - * for a particular event with the following syntax: + * Register a listener for a particular event with the following syntax: * (code) * strategy.events.register(type, obj, listener); * (end) * + * Supported event types: * - *start* Triggered before saving * - *success* Triggered after a successful transaction * - *fail* Triggered after a failed transaction * */ - EVENT_TYPES: ["start", "success", "fail"], /** * Property: events @@ -66,7 +64,7 @@ OpenLayers.Strategy.Save = OpenLayers.Class(OpenLayers.Strategy, { */ initialize: function(options) { OpenLayers.Strategy.prototype.initialize.apply(this, [options]); - this.events = new OpenLayers.Events(this, null, this.EVENT_TYPES); + this.events = new OpenLayers.Events(this); }, /** diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js index 888d4f753e..73c710d16a 100644 --- a/lib/OpenLayers/Tile.js +++ b/lib/OpenLayers/Tile.js @@ -26,10 +26,12 @@ OpenLayers.Tile = OpenLayers.Class({ /** - * Constant: EVENT_TYPES - * {Array(String)} Supported application event types + * Supported event types: + * - *loadstart* Triggered when tile loading starts. + * - *loadend* Triggered when tile loading ends. + * - *reload* Triggered when an already loading tile is reloaded. + * - *unload* Triggered before a tile is unloaded. */ - EVENT_TYPES: [ "loadstart", "loadend", "reload", "unload"], /** * APIProperty: events @@ -110,7 +112,7 @@ OpenLayers.Tile = OpenLayers.Class({ //give the tile a unique id based on its BBOX. this.id = OpenLayers.Util.createUniqueID("Tile_"); - this.events = new OpenLayers.Events(this, null, this.EVENT_TYPES); + this.events = new OpenLayers.Events(this); OpenLayers.Util.extend(this, options); }, diff --git a/tests/Control/DrawFeature.html b/tests/Control/DrawFeature.html index 5656647b7f..bcaca1c5e4 100644 --- a/tests/Control/DrawFeature.html +++ b/tests/Control/DrawFeature.html @@ -4,12 +4,10 @@