statuschange

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

The statuschange event is executed when the status of the Wifi connection changed. The possible statuses are:

connecting
Fires when the device starts the process of connecting to a network.
associated
Fires when the device has connected to an access point but do not yet have an IP address.
connected
Fires once we are fully connected to an access point and can access the internet.
disconnected
Fires when we either fail to connect to an access point (transition: associated -> disconnected) or when we were connected to a network but have disconnected for any reason (transition: connected -> disconnected).

General info

Specification
Wifi (Firefox OS specific) and WifiDirect (Firefox OS specific)
Interface
MozWifiStatusChangeEvent
Bubbles
No
Cancelable
No
Target
WifiManager, MozWifiP2pManager
Default Action
None

Properties

Property Type Description
target Read only EventTarget The event target (the topmost target in the DOM tree).
type Read only DOMString The type of event.
bubbles Read only boolean Does the event normally bubble?
cancelable Read only boolean Is it possible to cancel the event?
network Read only nsIVariant (object) Network object with an SSID field.
status Read only DOMString (string) Word describing the current status of the wifi manager. See possible values above.

Example

navigator.mozWifiManager.onstatuschange = function( event ) {
  console.log( "The connecttion to wifi network '" + event.network.SSID + "' switched to '" + event.status + "'." );
};

文档标签和贡献者