Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-it

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-it

Detect if a device is mouse only, touch only, or hybrid

  • 4.0.0-next.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is detect-it?

The detect-it npm package is designed to help developers detect various input methods and device capabilities. It can identify whether a device supports touch, mouse, or stylus inputs, and can also determine if the device is a mobile or desktop device.

What are detect-it's main functionalities?

Detecting Touch Support

This feature allows you to check if the device supports touch input. The `hasTouch` property will return `true` if touch is supported and `false` otherwise.

const detectIt = require('detect-it');
console.log(detectIt.hasTouch); // true or false

Detecting Mouse Support

This feature allows you to check if the device supports mouse input. The `hasMouse` property will return `true` if a mouse is supported and `false` otherwise.

const detectIt = require('detect-it');
console.log(detectIt.hasMouse); // true or false

Detecting Primary Input Method

This feature allows you to determine the primary input method of the device. The `primaryInput` property will return either 'mouse', 'touch', or 'stylus' based on the primary input method detected.

const detectIt = require('detect-it');
console.log(detectIt.primaryInput); // 'mouse', 'touch', or 'stylus'

Detecting Device Type

This feature allows you to determine the type of device. The `deviceType` property will return 'mouseOnly', 'touchOnly', 'hybrid', or 'unknown' based on the detected input methods.

const detectIt = require('detect-it');
console.log(detectIt.deviceType); // 'mouseOnly', 'touchOnly', 'hybrid', or 'unknown'

Other packages similar to detect-it

Keywords

FAQs

Package last updated on 21 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc