Web Workers API

·

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.