goog.events
Namespacegoog.events.ActionEvent
ClassThis class is used for the goog.events.ActionHandler.EventType.ACTION event. … more
goog.events.ActionHandler
ClassA wrapper around an element that you want to listen to ACTION events on. … more
goog.events.BeforeActionEvent
ClassThis class is used for the goog.events.ActionHandler.EventType.BEFOREACTION event. BEFOREACTION gives a chance to the application so the keyboard focus can be restored back, if required. … more
goog.events.BrowserEvent
ClassAccepts a browser event object and creates a patched, cross browser event object. The content of this object will not be initialized if no event object is provided. If this is the case, init() needs to be invoked separately. … more
goog.events.BrowserFeature
EnumEnum of browser capabilities. … more
goog.events.Event
ClassA base class for event objects, so that they can support preventDefault and stopPropagation. … more
goog.events.EventHandler
ClassSuper class for objects that want to easily manage a number of event listeners. It allows a short cut to listen and also provides a quick way to remove all events listeners belonging to this object. … more
goog.events.EventTarget
ClassInherit from this class to give your object the ability to dispatch events. Note that this class provides event sending behaviour, not event receiving behaviour: your object will be able to broadcast events, and other objects will be able to listen for those events using goog.events.listen().
The name "EventTarget" reflects the fact that this class implements the EventTarget interface as defined by W3C DOM 2/3, with a few differences:
Unless propagation is stopped, an event dispatched by an EventTarget
will bubble to the parent returned by getParentEventTarget
.
To set the parent, call setParentEventTarget
or override
getParentEventTarget
in a subclass. Subclasses that don't
support changing the parent should override the setter to throw an error.
Example usage:
var source = new goog.events.EventTarget(); function handleEvent(event) { alert('Type: ' + e.type + '\nTarget: ' + e.target); } goog.events.listen(source, 'foo', handleEvent); ... source.dispatchEvent({type: 'foo'}); // will call handleEvent // or source.dispatchEvent('foo'); ... goog.events.unlisten(source, 'foo', handleEvent); // You can also use the Listener interface: var listener = { handleEvent: function(event) { ... } }; goog.events.listen(source, 'bar', listener);… more
goog.events.EventType
EnumConstants for event names. … more
goog.events.EventWrapper
InterfaceInterface for event wrappers. @interface … more
goog.events.FileDropHandler
ClassA files drag and drop event detector. Gets an {@code element} as parameter and fires {@code goog.events.FileDropHandler.EventType.DROP} event when files are dropped in the {@code element}. … more
goog.events.FocusHandler
ClassThis event handler allows you to catch focus events when descendants gain or loses focus. … more
goog.events.ImeHandler
ClassDispatches high-level events for IMEs. … more
goog.events.InputHandler
ClassThis event handler will dispatch events when the user types into a text input, password input or a textarea … more
goog.events.KeyCodes
EnumKey codes for common characters. This list is not localized and therefore some of the key codes are not correct for non US keyboard layouts. See comments below. … more
goog.events.KeyEvent
ClassThis class is used for the goog.events.KeyHandler.EventType.KEY event and it overrides the key code with the fixed key code. … more
goog.events.KeyHandler
ClassA wrapper around an element that you want to listen to keyboard events on. … more
.KeyNames
Key names for common characters. This list is not localized and therefore some of the key codes are not correct for non-US keyboard layouts.
goog.events.Listener
ClassSimple class that stores information about a listener … more
goog.events.MouseWheelEvent
ClassA base class for mouse wheel events. This is used with the MouseWheelHandler. … more
goog.events.MouseWheelHandler
ClassThis event handler allows you to catch mouse wheel events in a consistent manner. … more
goog.events.OnlineHandler
ClassBasic object for detecting whether the online state changes. … more
goog.events.PasteHandler
ClassA paste event detector. Gets an {@code element} as parameter and fires {@code goog.events.PasteHandler.EventType.PASTE} events when text is pasted in the {@code element}. Uses heuristics to detect paste events in FF2. See more details of the heuristic on {@link #handleEvent_}. … more
.actionEventWrapper
{goog.events.ActionEventWrapper_
}Singleton instance of ActionEventWrapper_.
.dispatchEvent(src, e)
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
src
{goog.events.EventTarget
}
e
{string
|Object
|goog.events.Event
}
boolean
}
.expose(e)
Provides a nice string showing the normalized event objects public members
e
{Object
}
string
}
.fireListener(listener, eventObject)
Fires a listener with a set of arguments
listener
{goog.events.Listener
}
eventObject
{Object
}
boolean
}
.fireListeners(obj, type, capture, eventObject)
Fires an object's listeners of a particular type and phase
obj
{Object
}
type
{string
}
capture
{boolean
}
eventObject
{Object
}
boolean
}
.getListener(src, type, listener, opt_capt, opt_handler)
Gets the goog.events.Listener for the event or null if no such listener is in use.
src
{EventTarget
|goog.events.EventTarget
}
type
{?string
}
listener
{Function
|Object
}
opt_capt
{boolean
=}
opt_handler
{Object
=}
goog.events.Listener
?}
.getListeners(obj, type, capture)
Gets the listeners for a given object, type and capture phase.
obj
{Object
}
type
{string
}
capture
{boolean
}
Array
.<goog.events.Listener
>}
.getProxy()
Helper function for returning a proxy function.
Function
}
.getTotalListenerCount()
Gets the total number of listeners currently in the system.
number
}
.getUniqueId(identifier)
Creates a unique event id.
identifier
{string
}
string
}
.hasListener(obj, opt_type, opt_capture)
Returns whether an event target has any active listeners matching the specified signature. If either the type or capture parameters are unspecified, the function will match on the remaining criteria.
obj
{EventTarget
|goog.events.EventTarget
}
opt_type
{string
=}
opt_capture
{boolean
=}
boolean
}
.listen(src, type, listener, opt_capt, opt_handler)
Adds an event listener for a specific event on a DOM Node or an object that has implemented {@link goog.events.EventTarget}. A listener can only be added once to an object and if it is added again the key for the listener is returned.
src
{EventTarget
|goog.events.EventTarget
}
type
{string
|Array
.<string
>}
listener
{Function
|Object
}
opt_capt
{boolean
=}
opt_handler
{Object
=}
number
}
.listenOnce(src, type, listener, opt_capt, opt_handler)
Adds an event listener for a specific event on a DomNode or an object that has implemented {@link goog.events.EventTarget}. After the event has fired the event listener is removed from the target.
src
{EventTarget
|goog.events.EventTarget
}
type
{string
|Array
.<string
>}
listener
{Function
|Object
}
opt_capt
{boolean
=}
opt_handler
{Object
=}
number
}
.listenWithWrapper(src, wrapper, listener, opt_capt, opt_handler)
Adds an event listener with a specific event wrapper on a DOM Node or an object that has implemented {@link goog.events.EventTarget}. A listener can only be added once to an object.
src
{EventTarget
|goog.events.EventTarget
}
wrapper
{goog.events.EventWrapper
}
listener
{Function
|Object
}
opt_capt
{boolean
=}
opt_handler
{Object
=}
.protectBrowserEventEntryPoint(errorHandler)
Installs exception protection for the browser event entry point using the given error handler.
errorHandler
{goog.debug.ErrorHandler
}
.removeAll(opt_obj, opt_type, opt_capt)
Removes all listeners from an object, if no object is specified it will remove all listeners that have been registered. You can also optionally remove listeners of a particular type or capture phase.
opt_obj
{Object
=}
opt_type
{string
=}
opt_capt
{boolean
=}
number
}
.unlisten(src, type, listener, opt_capt, opt_handler)
Removes an event listener which was added with listen().
src
{EventTarget
|goog.events.EventTarget
}
type
{string
|Array
.<string
>}
listener
{Function
|Object
}
opt_capt
{boolean
=}
opt_handler
{Object
=}
boolean
}
.unlistenByKey(key)
Removes an event listener which was added with listen() by the key returned by listen().
key
{?number
}
boolean
}
.unlistenWithWrapper(src, wrapper, listener, opt_capt, opt_handler)
Removes an event listener which was added with listenWithWrapper().
src
{EventTarget
|goog.events.EventTarget
}
wrapper
{goog.events.EventWrapper
}
listener
{Function
|Object
}
opt_capt
{boolean
=}
opt_handler
{Object
=}