mdn/content

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

Open

#35,064 opened on 2024年7月25日

GitHub で見る
 (2 comments) (0 reactions) (0 assignees)Markdown (22,427 forks)batch import
Content:WebAPIarea: Workershelp wanted

Repository metrics

Stars
 (8,900 stars)
PR merge metrics
 (平均マージ 7d 3h) (30d で 147 merged PRs)

説明

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

コントリビューターガイド