npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-pwa-toolkit

v1.0.0

Published

Most common PWA functionality and APIs in one toolkit.

Readme

React-pwa-toolkit

Most common PWA helpers in one toolkit. Powered by Hooks

Don't hesitate to support the project on Github if you like it ❤️ Also, contributors are always welcome!

Overview

The library is made to help to detect what browser your user has and gives you a convenient API to access user behave and most useful device events.

Use cases

First of all, install it and require the library. This is a React Module.

yarn add react-pwa-toolkit
import React from "react";
import Device, { useNetwork, usePwa, useVisibility, useInstallPrompt } from "react-pwa-toolkit";

Browser detection

Use it inside useEffect.

useEffect(() => {
    console.log(Device());
})

It will be something like:

{
  "browser": {
    "name": "Safari",
    "version": "11.0"
  },
  "os": {
    "name": "iOS",
    "version": "11.0"
  },
  "platform": {
    "type": "mobile",
    "vendor": "Apple",
    "model": "iPhone"
  },
  "engine": {
    "name": "WebKit",
    "version": "604.1.38"
  }
}

Network Status

If network is available, isOnline will be true. (default: true)

const isOnline = useNetwork(); // true/false

PWA Status

Check user is using PWA or it is a browser.

const isPwa = usePwa(); // true/false

Visibility Status

You can track user behave when they move between tabs,
So it is helpful to play a music track when the document becomes visible and pauses the music when the document is no longer visible,
Or even lock the app when they leave it.

const isVisible = useVisibility(); // true/false

Add-to-home-screen helper and installation Status

Check user choice on add-to-home-screen prompt with installationStatus.
NOTE: If you set it's initial value as false in useInstallPrompt(false), it will show add-to-home-screen popup as soon as possible. BUT if you want to show a fancy popup to encourage user to install your app set the initial value as true like useInstallPrompt(true) then you have access to show the popup whenever you want.

const [installationStatus, installationEvent] = useInstallPrompt(true);

useEffect(() => {
    // installationStatus is one of these states: null/dismissed/accepted/installed
    if(installationStatus === 'accepted') {
        // User accept it. You can save it in some log with device config.
    }

    // Show Add-to-home-screen prompt, if user have it's condition.
    if(installationEvent) {
        installationEvent.prompt();
    }
})

License

Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.