Bada
Bada's Coding

Follow

Bada's Coding

Follow

Web Workers API

Bada's photo
Bada
·Dec 6, 2022·

1 min read

Introduction

Using Web Workers API, multithreading can be done.

However, things such as manipulating DOM cannot be done using the API.

Let me show you the same examples with and without the API.

Please click 'do something heavy' once and click 'increment' many times.

Without the API

The number doesn't change until the alert.

With the API

!!! If the alert doesn't pop up, open the result screen in a new tab.

The number changes even though the alert does not pop up.

 
Share this