🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@okiba/detect

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@okiba/detect

Feature detection

latest
Source
npmnpm
Version
1.0.9
Version published
Maintainers
3
Created
Source

Okiba / detect

Utilities to check some browser features

Installation

npm i --save @okiba/detect

Or import it directly in the browser

<script type="module" src="https://unpkg.com/@okiba/detect/index.js"></script>

Usage

import detect from '@okiba/detect'

Untranspiled code 🛑

Okiba UI packages are not transpiled, so don't forget to transpile them with your favourite bundler. For example, using Babel with Webpack, you should prevent imports from okiba to be excluded from transpilation, like follows:

{
  test: /\.js$/,
  exclude: /node_modules\/(?!(@okiba)\/).*/,
  use: {
    loader: 'babel-loader',
    options: {
      presets: ['@babel/preset-env']
    }
  }
}

hasPassiveEvents()

Check if browser supports passive events

import {hasPassiveEvents} from '@okiba/detect'

console.log(hasPassiveEvents) // true

Returns

Boolean true if browser supports passive events

hasTouch()

Check if browser has touch support

import {hasTouch} from '@okiba/detect'

console.log(hasTouch) // true

Returns

Boolean true if browser has touch support

FAQs

Package last updated on 05 Apr 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