GEvent [namespace]-GoogleMaps/API/doc/ClassReference/07-GEvent-N☆E 学習帳

[ リロード ]   [ ソース ]  [ トップ | 一覧 | 単語検索 | 最新 | バックアップ | ヘルプ ]

Counter: 3062, today: 1, yesterday: 2

GEvent [namespace]

http://www.google.com/apis/maps/docu­mentation/

Version 2 (2006.4)

This namespace contains functions that you use to register event handlers, both for custom events and for DOM events, and to fire custom events. All the events defined by this API are custom events that are internally fired by GEvent.triggerEvent().

Static Methods

Static Methods Return Value Description
addListener(source, event, handler) GEventListener Registers an event handler for a custom event on the source object. Returns a handle that can be used to eventually deregister the handler. The event handler will be called with this set to the source object.
addDomListener(source, event, handler) GEventListener Registers an event handler for a DOM event on the source object. The source object must be a DOM Node. Returns a handle that can be used to eventually deregister the handler. The event handler will be called with this set to the source object. This function uses the DOM methods for the current browser to register the event handler.
removeListener(handle) none Removes a handler that was installed using addListener() or addDomListener().
clearListeners(source, event) none Removes all handlers on the given object for the given event that were installed using addListener() or addDomListener().
clearInstanceListeners(source) none Removes all handlers on the given object for all events that were installed using addListener() or addDomListener().
trigger(source, event, ...) none Fires a custom event on the source object. All arguments after event are passed as arguments to the event handler functions.
bind(source, event, object, method) none Registers an invocation of the method on the given object as the event handler for a custom event on the source object. Returns a handle that can be used to eventually deregister the handler.
bindDom(source, event, object, method) none Registers an invocation of the method on the given object as the event handler for a custom event on the source object. Returns a handle that can be used to eventually deregister the handler.
callback(object, method) none Returns a closure that calls method on object.
callbackArgs(object, method, ...) none Returns a closure that calls method on object with the given arguments.

 

Events

Events Arguments Description
clearlisteners event? This event is fired on object when clearListeners() or clearInstanceListeners() is called on that object. Of course, the event is fired before the functions are executed.

 

Version 1

All event registration and triggering is handled by the GEvent class. All methods in the GEvent class are static methods, e.g., you should call the methods like GEvent.bind(...) rather than (new Event()).bind(...).

Static Methods

Method Description
addListener(source, eventName, listenerFn) Calls the given listenerFn function when the given event is triggered on the given source instance. We return an opaque listener token that can be used with removeListener.
removeListener(listener) Removes the given listener, which should be a listener returned by addListener
clearListeners(source, eventName) Removes all listeners for the given event on the given source
trigger(source, eventName, args...) Triggers the given event on the given source with the given list of arguments
bind(source, eventName, object, method) Binds the given method of the given object to the given source event. When the given event is triggered, the given method is called with object as the this, e.g., GEvent.bind(map, "move", this, this.onMapMove)