net.NetworkStatusMonitor Extends goog.events.Listenable
Base class for network status information providers.

Inheritance

Constructor

goog.net.NetworkStatusMonitor()

Instance Methods

Public Protected Private
isOnline() boolean
No description.
Returns: boolean  Whether the system is online or otherwise.
code »
dispatchEvent(e) boolean
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.
Arguments:
e : goog.events.EventLike
Event object.
Returns: boolean  If anyone called preventDefault on the event object (or if any of the listeners returns false) this will also return false.
code »
fireListeners(typecaptureeventObject) boolean
Fires all registered listeners in this listenable for the given type and capture mode, passing them the given eventObject. This does not perform actual capture/bubble. Only implementors of the interface should be using this.
Arguments:
type : string | !goog.events.EventId.<EVENTOBJ>
The type of the listeners to fire.
capture : boolean
The capture mode of the listeners to fire.
eventObject : EVENTOBJ
The event object to fire.
Returns: boolean  Whether all listeners succeeded without attempting to prevent default behavior. If any listener returns false or called goog.events.Event#preventDefault, this returns false.
code »
getListener(typelistenercaptureopt_listenerScope) goog.events.ListenableKey
Gets the goog.events.ListenableKey for the event or null if no such listener is in use.
Arguments:
type : string | !goog.events.EventId.<EVENTOBJ>
The name of the event without the 'on' prefix.
listener : function(this:SCOPE, EVENTOBJ):(boolean | undefined)
The listener function to get.
capture : boolean
Whether the listener is a capturing listener.
opt_listenerScope : SCOPE=
Object in whose scope to call the listener.
Returns: goog.events.ListenableKey  the found listener or null if not found.
code »
getListeners(typecapture) !Array.<goog.events.ListenableKey>
Gets all listeners in this listenable for the given type and capture mode.
Arguments:
type : string | !goog.events.EventId
The type of the listeners to fire.
capture : boolean
The capture mode of the listeners to fire.
Returns: !Array.<goog.events.ListenableKey>  An array of registered listeners.
code »
getParentEventTarget() goog.events.Listenable
Returns the parent of this event target to use for capture/bubble mechanism. NOTE(user): The name reflects the original implementation of custom event target ( goog.events.EventTarget). We decided that changing the name is not worth it.
Returns: goog.events.Listenable  The parent EventTarget or null if there is no parent.
code »
hasListener(opt_typeopt_capture) boolean
Whether there is any active listeners matching the specified signature. If either the type or capture parameters are unspecified, the function will match on the remaining criteria.
Arguments:
opt_type : string | !goog.events.EventId.<EVENTOBJ>>
Event type.
opt_capture : boolean=
Whether to check for capture or bubble listeners.
Returns: boolean  Whether there is any active listeners matching the requested type and/or capture phase.
code »
listen(typelisteneropt_useCaptureopt_listenerScope) goog.events.ListenableKey
Adds an event listener. A listener can only be added once to an object and if it is added again the key for the listener is returned. Note that if the existing listener is a one-off listener (registered via listenOnce), it will no longer be a one-off listener after a call to listen().
Arguments:
type : string | !goog.events.EventId.<EVENTOBJ>
The event type id.
listener : function(this:SCOPE, EVENTOBJ):(boolean | undefined)
Callback method.
opt_useCapture : boolean=
Whether to fire in capture phase (defaults to false).
opt_listenerScope : SCOPE=
Object in whose scope to call the listener.
Returns: goog.events.ListenableKey  Unique key for the listener.
code »
listenOnce(typelisteneropt_useCaptureopt_listenerScope) goog.events.ListenableKey
Adds an event listener that is removed automatically after the listener fired once. If an existing listener already exists, listenOnce will do nothing. In particular, if the listener was previously registered via listen(), listenOnce() will not turn the listener into a one-off listener. Similarly, if there is already an existing one-off listener, listenOnce does not modify the listeners (it is still a once listener).
Arguments:
type : string | !goog.events.EventId.<EVENTOBJ>
The event type id.
listener : function(this:SCOPE, EVENTOBJ):(boolean | undefined)
Callback method.
opt_useCapture : boolean=
Whether to fire in capture phase (defaults to false).
opt_listenerScope : SCOPE=
Object in whose scope to call the listener.
Returns: goog.events.ListenableKey  Unique key for the listener.
code »
removeAllListeners(opt_type) number
Removes all listeners from this listenable. If type is specified, it will only remove listeners of the particular type. otherwise all registered listeners will be removed.
Arguments:
opt_type : string=
Type of event to remove, default is to remove all types.
Returns: number  Number of listeners removed.
code »
unlisten(typelisteneropt_useCaptureopt_listenerScope) boolean
Removes an event listener which was added with listen() or listenOnce().
Arguments:
type : string | !goog.events.EventId.<EVENTOBJ>
The event type id.
listener : function(this:SCOPE, EVENTOBJ):(boolean | undefined)
Callback method.
opt_useCapture : boolean=
Whether to fire in capture phase (defaults to false).
opt_listenerScope : SCOPE=
Object in whose scope to call the listener.
Returns: boolean  Whether any listener was removed.
code »
unlistenByKey(key) boolean
Removes an event listener which was added with listen() by the key returned by listen().
Arguments:
key : goog.events.ListenableKey
The key returned by listen() or listenOnce().
Returns: boolean  Whether any listener was removed.
code »

Enumerations

goog.net.NetworkStatusMonitor.EventType :
Enum for the events dispatched by the OnlineHandler.
Constants:
OFFLINE
No description.
ONLINE
No description.
Code »

Package net

Package Reference