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

@adwatch/browserdetect

v2.0.6

Published

detecting browser version

Downloads

238

Readme

BrowserDetect

Browser detect module
http://browserdetect.module.frontend.production.adwatch.ru

Install

$ npm install --save @adwatch/browserdetect

Usage

import BrowserDetect from '@adwatch/browserdetect';		// for es6

var BrowserDetect = require('@adwatch/browserdetect/build');	// for es5

let browserDetect = new BrowserDetect(options);

Get started


let browserDetect = new BrowserDetect(options);

API

Options

| Name | Type | Description | | :------------------------- | :--------- | :------ | | timeOutLocalStorageName | number | Variable timeout name for localStorage. Default - 0. | | check | array | Browser verification options*. | | onInit | function | Inited browsercheck callback. | | onCheckFailed | function | Checked old browser callback. |

* Browser verification options:

Array - [name, platform, version, device], [name, platform, version, device],...

| Value | Type | Description | | :------------ | :--------- | :------ | | name | string | Browser name (msie, edge, safari, blackberry, yandex, playbook, opera, opera mini, android, kindle, silk, firefox, chrome) - required. | | version | string | Maximum browser version - optional. | | platform | string | Platform (ipod, ipad, iphone, kindle, silk, android, windows phone, win, mac, linux, cros, playbook, blackberry) - optional. | | device | string | Device (desktop, mobile) - optional. |

/**
* 	Default:
* 	
*	['edge', '14', false, 'desktop'],
*	['msie', '11', false, 'desktop'],
*	['chrome', '49', 'win', 'desktop'],
*	['firefox', '52'],
*	['opera', '47'],
*	['safari', false, 'win'],
*	['safari', '10', 'mac']
* 	
*/

Callbacks option arguments

onInit arguments: ({ browser data})

onCheckFailed arguments: ({ browser data })

Callbacks return data:

| Key | Type | Description | | :------------------------- | :--------- | :------ | | browserName | string | Browser name | | browserVersion | number | Browser version major. | | browserVersionFull | string | Browser full version | | checkFailed | boolean | Browser compliance with the specified options | | devicePlatform | string | Device platform | | deviceType | string | Device type (desktop or mobile) | | timeout | number | Time of absence of verification (in ms) | | webkit | boolean | Webkit - type check |

Methods

browserDetect.setTimeOut(hours);

Setting the time in hours for absence of verification

browserDetect.getTimeOut(type)

Return actual timeout in ms

type (default returned in milliseconds);
s - returned in seconds;
m - returned in minutes;
h - returned in hours;

License

MIT ©