SummaryEdit
The onclose
property of the WorkerGlobalScope
interface represents an EventHandler
to be called when the close
event occurs and bubbles through the Worker
.
SyntaxEdit
self.onclose = function() { ... };
ExampleEdit
The following code snippet shows an onclose
handler set inside a worker:
self.onclose = function() {
console.log('Your worker instance has been closed');
}
SpecificationsEdit
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'WorkerGlobalScope.onclose' in that specification. |
Living Standard | No change from Web Workers. |
Web Workers The definition of 'WorkerGlobalScope.onclose' in that specification. |
Candidate Recommendation | Initial definition. |
Browser compatibilityEdit
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 4 | 3.5 (1.9.1) | (Yes) | 11.5 | 4 |
See alsoEdit
The WorkerGlobalScope
interface it belongs to.