[Mapbender-commits] r3201 - branches/noframes/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Nov 7 05:12:59 EST 2008


Author: christoph
Date: 2008-11-07 05:12:59 -0500 (Fri, 07 Nov 2008)
New Revision: 3201

Modified:
   branches/noframes/lib/event.js
Log:
added scope to registered functions

Modified: branches/noframes/lib/event.js
===================================================================
--- branches/noframes/lib/event.js	2008-11-07 10:12:12 UTC (rev 3200)
+++ branches/noframes/lib/event.js	2008-11-07 10:12:59 UTC (rev 3201)
@@ -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;
-};
\ No newline at end of file
+	var scope = aScope;
+};



More information about the Mapbender_commits mailing list