From 994e00ad2027738b4b259652bb2d4af969447348 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 4 Jul 2006 11:42:20 +0000 Subject: [PATCH] add more complete comment to register function, sort of explaining binding. git-svn-id: http://svn.openlayers.org/trunk/openlayers@865 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Events.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 040ccc870e..3f850f8691 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -77,8 +77,23 @@ OpenLayers.Events.prototype = { /** * @param {String} type Name of the event to register - * @param {Object} obj The object to bind the context to for the callback + * @param {Object} obj The object to bind the context to for the callback# * @param {Function} func The callback function + * + * #When the event is triggered, the 'func' function will be called, in the + * context of 'obj'. Imagine we were to register an event, specifying an + * OpenLayers.Bounds Object as 'obj'. When the event is triggered, the + * context in the callback function will be our Bounds object. This means + * that within our callback function, we can access the properties and + * methods of the Bounds object through the "this" variable. So our + * callback could execute something like: + * + * alert("Left: " + this.left); + * + * or + * + * alert("Center: " + this.getCenterLonLat()); + * */ register: function (type, obj, func) { if (func == null) {