SharedWorker: error Ereignis
Das error
-Ereignis der SharedWorker
-Schnittstelle wird ausgelöst, wenn ein Fehler im Worker auftritt.
Syntax
Verwenden Sie den Ereignisnamen in Methoden wie addEventListener()
oder setzen Sie eine Ereignis-Handler-Eigenschaft.
js
addEventListener("error", (event) => {});
onerror = (event) => {};
Ereignistyp
Ein generisches Event
.
Beispiel
Der folgende Code-Schnipsel erstellt ein SharedWorker
-Objekt mit dem SharedWorker()
-Konstruktor und richtet einen onerror
-Handler auf dem resultierenden Objekt ein:
js
const mySharedWorker = new SharedWorker("shared-worker.js");
mySharedWorker.onerror = (event) => {
console.error("There is an error with your worker!");
};
Spezifikationen
Specification |
---|
HTML # handler-abstractworker-onerror |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
error event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.