Last active
May 5, 2021 09:53
-
-
Save exaucae/961abe2014964e98ae945b699b198d7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Workers are just scripts that runs on a separate thread from the main browser thread. Javascipt has 3 categories: | |
- Web workers : general purpose workers | |
- Service workers : proxy between the browser and the network / cache; have custom methods | |
- Worklets: hook into the browser’s rendering pipeline, enabling you to have low-level access to the browser’s rendering processes such as styling and layout | |
Workers: | |
- are registered in the main javascript file of your project | |
- do not have access to the DOM; thus get messages and props via callbacks ( postMessage & onMessage ) | |
Further: | |
- working with web workers with comlink: | |
- article: https://davidea.st/articles/comlink-simple-web-worker | |
- github repository: https://github.com/GoogleChromeLabs/comlink | |
- mozilla ref doc on service workers: https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API | |
- mocking with service workers & msw: | |
- github repository: https://mswjs.io/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment