Coder Social home page Coder Social logo

pixu1980 / detector-js Goto Github PK

View Code? Open in Web Editor NEW
29.0 2.0 7.0 3.87 MB

DetectorJS, zero-dependency platform/environment detector written in ES6

Home Page: http://detector.js.org

License: MIT License

JavaScript 18.58% TypeScript 81.03% HTML 0.40%
detector detector-js detection feature-detection platform-detection cpu-detection gpu-detection browser-detection layout-engine-detection engine-detection

detector-js's Introduction

detector-js

v2.0.11

Description

DetectorJS, zero-dependency platform/environment detector written in TypeScript

Please feel free to ask for modifications, fixes or do a PR to improve Detector behaviors or add detection rules

Author

Emiliano 'Pixu' Pisu <[email protected]>

Badges

NPM

NPM downloads/month GitHub stars GitHub forks GitHub issues GitHub license Build Status Coverage Status

Documentation

Check out the Latest Documentation here

Installation

This is a JS/TS module available through the npm registry.

It can be installed using either npm or yarn package managers.

npm i detector-js
yarn add detector-js

Usage

import { Detector } from 'detector-js';

const detector = new Detector();

// It's possible to specify a custom userAgent if needed
// const detector = new Detector('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15');

console.log(detector);
// {
//   engine:{
//     name:'WebKit',
//     version:'605.1.15'
//   },
//   browser:{
//     name:'Safari',
//     version:'12.0.3'
//   },
//   os:{
//     name:'macOS',
//     version:'10.14.3',
//     versionName:'Mojave'
//   },
//   cpu:{
//     platform:'MacIntel',
//     cores:1,
//     architecture:'x64',
//     vendor:'intel'
//   },
//   gpu:{
//     webGLVendor:'WebKit',
//     webGLRenderer:'WebKit WebGL',
//     vendor:'Intel Inc.',
//     model:'Intel Iris',
//     renderer:'Intel Iris OpenGL Engine'
//   },
//   platform:'desktop',
//     feature: {
//     pointerEnabled:false,
//     pixelRatio:1,
//     pointerLock:true,
//     quirksMode:false,
//     css3D:true,
//     cssTransform:true,
//     cssTransition:true,
//     deviceMotion:false,
//     deviceOrientation:false,
//     contextMenu:false,
//     classList:false,
//     placeholder:true,
//     viewportUnit:true,
//     remUnit:true,
//     canvas:true,
//     svg:true,
//     webGL:true,
//     webVR:false,
//     touch:false,
//     forceTouch:true,
//     srcset:true,
//     sizes:true,
//     pictureElement:true,
//     dialogElement:false,
//     addEventListener:true,
//     asyncScript:true,
//     battery:false,
//     cors:true,
//     deferScript:true,
//     file:true,
//     fileSystem:false,
//     fullscreen:true,
//     fullscreenKeyboard:true,
//     geolocation:true,
//     historyAPI:true,
//     littleEndian:false,
//     localStorage:true,
//     matchMedia:true,
//     querySelector:true,
//     querySelectorAll:true,
//     serviceWorker:true,
//     typedArray:true,
//     userMedia:false,
//     vibration:false,
//     worker:true,
//     audio:{
//       supported:true,
//       context:true,
//       formats:{
//         mp3:true,
//         webm:false,
//         ogg:false,
//         opus:false,
//         wav:true,
//         m4a:true
//       }
//     },
//     video:{
//       supported:true,
//       formats:{
//         mp4:true,
//         ogv:false,
//         webm:false
//       }
//     }
//   }
// }

Todo

  • refine browsers regexes
  • refine documentation
  • implement modular custom build feature
  • decide to implement or not device infos detection

Dependencies

Dev Dependencies

  • @parcel/packager-ts: DetectorJS, zero-dependency platform/environment detector written in TypeScript
  • @parcel/transformer-typescript-types: DetectorJS, zero-dependency platform/environment detector written in TypeScript
  • @types/node: TypeScript definitions for Node.js
  • lerna: Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository
  • parcel: Blazing fast, zero configuration web application bundler
  • pkg-2-readme: Generate a README.md from package.json contents
  • standard-version: replacement for npm version with automatic CHANGELOG generation
  • typedoc: Create api documentation for TypeScript projects.
  • typescript: TypeScript is a language for application scale JavaScript development

License

MIT

Powered By

JS.ORG Logo

detector-js's People

Contributors

pixu1980 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

detector-js's Issues

Opera on iOS not beeing recognized

UserAgent String:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Mobile/15E148 Safari/604.1 OPT/4.6.1

On other OS Opera seems to attach OPR/xxx but on at least ios 17_4 as experienced by one of my users, OPT/ seems to be the right identifier for Opera.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.