[Mapbender-commits] r3190 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Nov 6 10:19:35 EST 2008


Author: christoph
Date: 2008-11-06 10:19:35 -0500 (Thu, 06 Nov 2008)
New Revision: 3190

Modified:
   trunk/mapbender/lib/event.js
Log:
http://trac.osgeo.org/mapbender/ticket/318

Modified: trunk/mapbender/lib/event.js
===================================================================
--- trunk/mapbender/lib/event.js	2008-11-06 15:08:56 UTC (rev 3189)
+++ trunk/mapbender/lib/event.js	2008-11-06 15:19:35 UTC (rev 3190)
@@ -23,9 +23,9 @@
 	 * A function that needs to be executed, when the event occurs, has to be 
 	 * registered via this function.
 	 */
-	this.register = function(aFunction) {
+	this.register = function(aFunction, scope) {
 
-		var mpbnFunction = new MapbenderFunction(aFunction);
+		var mpbnFunction = new MapbenderFunction(aFunction, scope);
 		functionArray.push(mpbnFunction);
 	};
 
@@ -145,7 +145,7 @@
 /**
  * A MapbenderFunction is a function with a priority.
  */
-var MapbenderFunction = function (aFunction) {
+var MapbenderFunction = function (aFunction, aScope) {
 	
 	// public
 	/**
@@ -160,6 +160,9 @@
 	 */
 	this.execute = function (argumentObj) {
 		if (typeof(aFunction) == "function") {
+			if (scope) {
+				return aFunction.call(scope, argumentObj);
+			}
 			return func(argumentObj);
 		}
 
@@ -190,4 +193,5 @@
 	
 	// private
 	var func = aFunction;
+	var scope = aScope;
 };
\ No newline at end of file



More information about the Mapbender_commits mailing list