UNPKG

@interopio/browser-worker

Version:

IO Connect Browser service worker module

36 lines (21 loc) 1.33 kB
# @interopio/browser-worker ## Overview The [`@interopio/browser-worker`](https://www.npmjs.com/package/@interopio/browser-worker) library is designed to be imported into the Service Worker file of your Browser Client app. The library enables your **io.Connect Browser** project to correctly process notification actions and their respective click logic. ## Installation To install the library, execute the following command: ```cmd npm install @interopio/browser-worker ``` ## Usage The following examples demonstrate basic initialization of the `@interopio/browser-worker` library in your Service Worker file. > ℹ️ *For more details on using the `@interopio/browser-worker` library, see the **io.Connect Browser** [official documentation](https://docs.interop.io/browser/capabilities/notifications/setup/index.html#ioconnect_browser_worker).* Importing the package in a dedicated Service Worker project the output of which will be a ready Service Worker script: ```javascript const IOWorker = require("@interopio/browser-worker"); IOWorker(); ``` Using the `importScripts()` function to add the io.Connect Browser Worker to the Service Worker scope. This is suitable for basic Service Worker scripts: ```javascript importScripts("/web.worker.umd.js"); self.IOWorker(); ```