🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

feature-detector

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feature-detector

A tool for detecting environment features.

0.1.5
latest
Source
npm
Version published
Weekly downloads
10
233.33%
Maintainers
1
Weekly downloads
 
Created
Source

Feature Detector

Build status npm version Dependencies

An extensible tool for detecting environment features such as WebGL or Web Workers.

API Reference

Installation

npm install feature-detector

Usage

Basics
import { Detector, FeatureId } from "feature-detector";

const detector = new Detector();
const feature = detector.get(FeatureId.WEBGL);

console.log(feature.supported);
console.log(detector.getMessage(feature));
Custom Features
import { Feature } from "feature-detector";

export class MyFeature extends Feature {

	constructor() {

		super();

		this.name = "My Feature";

		// Check if your feature is supported in this environment.
		// Note that this.root serves as a reference to the global scope.
		this.supported = true || false;

	}

}
import { Detector } from "feature-detector";
import { MyFeature } from "./MyFeature.js";

const detector = new Detector();
const MY_ID = "my-feature";

detector.set(MY_ID, new MyFeature());

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Keywords

html5

FAQs

Package last updated on 18 Aug 2017

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