Event

Description

An event.  What happens, when the event occurs, depends on which functions have been registered with the event.

usage

// create a new Event
var eventAfterMapRequest = new MapbenderEvent();

// register a function with that event
eventAfterMapRequest.register(function () {
   ...
})

// trigger the event
eventAfterMapRequest.trigger();

Files

  • lib/event.js

Maintainer

http://www.mapbender.org/Christoph_Baudson

License

Copyright © 2009, Open Source Geospatial Foundation This program is dual licensed under the GNU General Public License and Simplified BSD license.  http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt

Summary
EventAn event.
Functions
Mapbender.Event
registerA function that needs to be executed, when the event occurs, has to be registered via this function.
unregisterExclude a previously registered function from the event permanently
isRegisteredChecks if a function is already registered with this event.
triggerThis function triggers the event.

Functions

Mapbender.Event

var MapbenderEvent = Mapbender.Event = function ()

register

this.register = function(aFunction,
scope)

Description

A function that needs to be executed, when the event occurs, has to be registered via this function.

Parameters

closurea function (or a string for backwards compatibility) which is called (evaluated) when the trigger method is called.
scope[optional] if given, the function is not simply executed, but called with JavaScript’s call function
func.call(scope, argumentObj)

unregister

this.unregister = function(aFunction)

Description

Exclude a previously registered function from the event permanently

Parameters

closurea function (or a string for backwards compatibility)

isRegistered

this.isRegistered = function (aFunction)

Description

Checks if a function is already registered with this event.  This can be used to avoid duplicate registers.

Parameters

closurea function (or a string for backwards compatibility)

trigger

this.trigger = function(properties,
booleanOperator)

Description

This function triggers the event.

Parameters

propertiesan object containing the arguments to be passed to the registered functions
operator[optional] a string that specifies how the return values of the individual registered functions shall be combined.  Available operators are “AND”, “OR” and “CAT” (string concatenation).  The default return value is the return value of the last registered function.
var MapbenderEvent = Mapbender.Event = function ()
this.register = function(aFunction,
scope)
A function that needs to be executed, when the event occurs, has to be registered via this function.
this.unregister = function(aFunction)
Exclude a previously registered function from the event permanently
this.isRegistered = function (aFunction)
Checks if a function is already registered with this event.
this.trigger = function(properties,
booleanOperator)
This function triggers the event.
Close