Articles and Tutorials

GSEventManager

GSEventManager provides an interface for managing the registration of event handlers for DOM objects.
Object
|
+--GSEventManager
Constructor Summary
GSEventManager ()
            GSEventManager should not be instantiated, all of its methods are called statically.
 
Method Summary
<static> Object addEventListener(<Object> obj, <String> eventType, <Function> func)
           Registers the given function func as a handler for events of the specified type occurring on the source object, obj.
<static> Object bind(<Object> subject, <String> eventType, <Object> observer, <Function> method)
           Binds an event on the subject to a method of the observing class.
<static> void release(<Object> token)
           Removes the binding of the subject event to a method on it's observer.
<static> void removeEventListener(<Object> token)
           Removes the given function func as a handler for the events of the specified type on the source object.

Constructor Detail

GSEventManager

GSEventManager()
    GSEventManager should not be instantiated, all of its methods are called statically.
Method Detail

addEventListener

<static> Object addEventListener(<Object> obj, <String> eventType, <Function> func)
    Registers the given function func as a handler for events of the specified type occurring on the source object, obj. This method encapsulates the appropriate browser-specific calls to register the handler. This function returns a token that can be passed to the GSEventManager.removeEventListener() to remove the event listener.
  •  
      obj - the object to add the listener to
      eventType - the event type to add the listener for. Can be one of: click, mousedown, mouseup, mouseover, mouseout
      func - The function to invoke when the event is triggered
  • Parameters:

bind

<static> Object bind(<Object> subject, <String> eventType, <Object> observer, <Function> method)
    Binds an event on the subject to a method of the observing class. Returns a token that can be passed to the GSEventManager.release() method to remove the binding.
  •  
      subject - the object whose state is being observed
      eventType - the type of event which the observing object is subscribing to
      observer - the object that is listening for events of a specific type occurring on the subject
      method - the method of the observer that should be bound to the target method of the subject
  • Parameters:

release

<static> void release(<Object> token)
    Removes the binding of the subject event to a method on it's observer.
  •  
      token - a token identifying the binding to release
  • Parameters:

removeEventListener

<static> void removeEventListener(<Object> token)
    Removes the given function func as a handler for the events of the specified type on the source object. This method encapsulates the appropritate browser-specific calls to de-register the handler.
  •  
      token - a token identifying the registered event handler to remove
  • Parameters: