Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Globant development week / Web workers

57 views

Published on

What is a web worker? Let's talk about it.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Globant development week / Web workers

  1. 1. Web Workers Eduard A. Martinez R. Globant
  2. 2. About Me ● Web UI Developer ● +2 years in Globant ● Member of Transformers POD ● Trying to be a singer eduard.martinez@globant.com
  3. 3. Let’s talk about… Web Workers!
  4. 4. Web workers to THE RESCUE!
  5. 5. “A web worker is a JavaScript that runs in the background, independently of other scripts, without affecting the performance of the page” Web Hypertext Application Technology Working Group (WHATWG)
  6. 6. But wait...
  7. 7. “Wasn’t JavaScript a single-threaded language?”.
  8. 8. Available Features ● The navigator object ● The location object (read-only) ● XMLHttpRequest ● setTimeout()/clearTimeout() and setInterval()/clearInterval() ● The Application Cache ● Importing external scripts using importScripts() ● Creating other web workers
  9. 9. Unavailable Features ● The DOM (it’s not thread-safe) ● The window object ● The document object ● The parent object
  10. 10. Types ● Dedicated workers ● Shared workers ● Service workers
  11. 11. Dedicated Workers
  12. 12. Dedicated Workers
  13. 13. Dedicated Workers Example
  14. 14. Shared Workers
  15. 15. Shared Workers
  16. 16. Shared Workers Ports are the key!
  17. 17. Shared Workers Example
  18. 18. Dedicated Workers Shared Workers Service Workers
  19. 19. Service Workers
  20. 20. Service Workers
  21. 21. Service Workers
  22. 22. Service Workers
  23. 23. Service Workers Example
  24. 24. Vestibulum congue Vestibulum congueVestibulum congue Offline Content Background SyncPush Notifications PWA
  25. 25. Libraries ● CatilinJS ● Threads.js ● UpUp (Offline Library) ● Workbox (Service Workers) … And so much more
  26. 26. Limitations ● Don’t have DOM interaction ● Send a function into postMessage() is not allowed ● High memory cost ● postMessage can only transmit strings ● Not intended to be used in big numbers
  27. 27. Questions?
  28. 28. Thank you!

×