什么是共享工作者?工人与共享工人之间的区别?

What is shared worker? Different between worker vs shared worker?

我不得不看共享工作者的例子。但我无法确定工人与共享工人之间的区别。 共享工作者示例 https://github.com/mdn/simple-shared-worker。 谁能解释一下?

Worker 和 SharedWorker 的工作流程如下。

Difference between Worker and SharedWorker

Worker 和 Shared Worker 之间的相似特征。

   The Worker works in another thread. So it's not affecting the main thread. So that time users can scroll, view the page without blocking.

1. Worker can't access DOM elements from the web page.
2. Worker can't access global variables and functions from the web page.
3. Worker can't call alert() function.
4. Objects such as window, parent, document can't be accessed inside the worker.

工人自己的特点。

Workers life time between page creates and closure. Once the page creates the new workers will be created. View first image that blog diagram says about Wokers.

Shared Worker 自己的功能。

Shared Worker 连接来自同一域的所有网页。查看博客图表中关于 Wokers 与 Shared Workers 的第二张图片。

参考link、Workers document