mdn/content

Improve `messageerror` example to show a case in which the event is fired

Open

#35 064 ouverte le 25 juil. 2024

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)Markdown (22 427 forks)batch import
Content:WebAPIarea: Workershelp wanted

Métriques du dépôt

Stars
 (8 900 stars)
Métriques de merge PR
 (Merge moyen 7j 3h) (147 PRs mergées en 30 j)

Description

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Worker/messageerror_event

What specific section or headline is this issue about?

Example

What information was incorrect, unhelpful, or incomplete?

I was trying to figure out what code can cause a messageerror event, and after failing to figure it out by myself I decided to go read on MDN.

Unfortunately MDN is very vague: it says that the error is fired when something cannot be deserialized, but it does not actually say in which case something can fail being deserialized.

What did you expect to see?

The example should have to different threads:

  • the main thread postMessages something to the worker thread
  • the worker thread fails to deserialize it and fires the messageerror event

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

Guide contributeur