1.0.0 • Published 1 year ago

@hazae41/worker-online-polyfill v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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 📦Deno Module 🦖

Features

  • ESModules and CommonJS
  • No external dependency

Usage

How?

ESModules

import "@hazae41/worker-online-polyfill"

CommonJS

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

Deno

import "https://deno.land/x/worker_online_polyfill/src/mod.ts"

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"))