Fires when the captive portal state changes.
browser.captivePortal.onStateChanged.addListener(callback)
浏览器
.
captivePortal
.
onStateChanged
.
removeListener
(
listener
)
浏览器
.
captivePortal
.
onStateChanged
.
hasListener
(
listener
)
Events have three functions:
addListener(callback)
Adds a listener to this event.
removeListener(listener)
Stop listening to this event. The
listener
argument is the listener to remove.
hasListener(listener)
校验是否
listener
is registered for this event. Returns
true
if it is listening,
false
否则。
callback
Function that is called when this event occurs. The function is passed the following arguments:
details
string
The captive portal state, being one of
未知
,
not_captive
,
unlocked_portal
,或
locked_portal
.
Handle a change in captive portal status:
function handlePortalStatus(portalstatusInfo) {
console.log("The portal status is now: " + portalstatusInfo.details);
}
browser.captivePortal.onStateChanged.addListener(handlePortalStatus)
BCD tables only load in the browser
最后修改: , 由 MDN 贡献者