Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 783 Bytes

README.md

File metadata and controls

42 lines (27 loc) · 783 Bytes

WebWorkers "online" and "offline" events polyfill

Polyfill for online and offline events on WebWorkers

https://issues.chromium.org/issues/40155587

npm i @hazae41/worker-online-polyfill

Node Package 📦

Features

  • ESModules and CommonJS
  • No external dependency

Usage

How?

ESModules

import "@hazae41/worker-online-polyfill"

CommonJS

require("@hazae41/worker-online-polyfill")

Where?

You can import the polyfill in your worker entry file or in a specific file

import "@hazae41/worker-online-polyfill"

self.addEventListener("online", () => console.log("online"))
self.addEventListener("offline", () => console.log("offline"))