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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-config-hooks

v1.1.0

Published

Deliver experiences best suited to a user's OS, device type, browser and other things

Downloads

1

Readme

react-config-hooks

Deliver experiences best suited to a user's OS, device type, browser, and other things

NPMJavaScript Style Guide License: MIT Inline docs contributions welcome

This is a suite of React Hooks and utilities for adaptive loading based on a user's:

  • Operating System
  • Browser
  • Configuration

Objective

Make it easier for developer to target different devices based on their configuration. It can be used to check different settings related to config in order to deliver best experiences to user.

Install

npm install --save react-config-hooks

Usage

Operating System

import { useOS } from 'react-config-hooks'

const [ os,isWin,isMac,isUnix,isLinux,isWinMob,isAndroid,isiOS ] = useOS()
 

| Value | Returns | Return type | |----------|:-------------------:|------:| | os | Returns the name of OS | String | | isWin | Returns true if OS is Windows and vice versa | boolean | | isMac | Returns true if OS is Mac and vice versa | boolean | | isUnix | Returns true if OS is Unix and vice versa | boolean | | isLinux | Returns true if OS is Linux and vice versa | boolean | | isWinMob | Returns true if OS is Windows Mobile and vice versa | boolean | | isAndroid | Returns true if OS is Android and vice versa | boolean | | isiOS | Returns true if OS is iOS and vice versa | boolean |  


Browser

import { useBrowser } from 'react-config-hooks'

const [ browser,isChrome,isFirefox,isIE,isEdge,isSafari,isOpera,isYandex ] = useBrowser()
 

| Value | Returns | Return type | |----------|:-------------------:|------:| | browser | Returns the name of browser | String | | isChrome | Returns true if browser is Chrome and vice versa | boolean | | isFirefox | Returns true if browser is Firefox and vice versa | boolean | | isIE | Returns true if browser is IE and vice versa | boolean | | isEdge | Returns true if browser is Edge and vice versa | boolean | | isSafari | Returns true if browser is Safari and vice versa | boolean | | isOpera | Returns true if browser is Opera and vice versa | boolean | | isYandex | Returns true if browser is Yandex and vice versa | boolean |  


Config

import { useConfig } from 'react-config-hooks'

const [ deviceConfig,isCookieEnabled,isOnLine,knownLangs,prefLang,isJavaEnabled ] = useConfig()
 

| Value | Returns | Return type | |----------|:-------------------:|------:| | deviceConfig | Returns the different properties (isCookieEnabled,isOnLine,knownLangs,prefLang,isJavaEnabled) related to config | Arrays of objects | | isCookieEnabled | Returns true if cookie is enabled and vice versa | boolean | | isOnLine | Returns true if user is online and vice versa | boolean | | knownLangs | Returns an array representing the languages known to the user, by order of preference | array | | prefLang | Returns an string representing the preferred language of the user, usually the language of the browser UI. The null value is returned when this is unknown. | String | | isJavaEnabled | Returns true if Java is enabled and vice versa | boolean |

 


License

MIT © dev-saeed