Web APIsLesson 59Free preview
Web Workers API
This lesson is part of HTML · All levels
Summary
Web Worker allows JavaScript to run on separate background threads so heavy tasks like computing don't freeze the page view. Worker is created with a new constructor and communicates via an interthread message using postMessage. It keeps the user experience smooth despite the heavy process.
Key points
- Web Worker runs the script in a separate background thread
- Made with new Worker("skrip.js")
- Communication using postMessage and event message
- Worker can't access the DOM page directly
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.