WorkerGlobalScope: online event
The online
event of the WorkerGlobalScope
fires when the device reconnects to the internet.
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener('online', event => { });
ononline = event => { };
Event type
A generic Event
.
Example
The following code snippet shows an onoffline
handler set inside a worker:
self.ononline = function() {
console.log('Your worker is now online');
}
The same snippet, but using addEventListener()
:
self.addEventListener('online', function() {
console.log('Your worker is now online');
}
Specifications
No specification found
No specification data found for api.WorkerGlobalScope.online_event
.
Check for problems with this page or contribute a missing spec_url
to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.
Browser compatibility
No compatibility data found for api.WorkerGlobalScope.online_event
.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.
See also
The WorkerGlobalScope
interface it belongs to.