@realeyes/environment-detector
Environment Detector
Last updated 4 months ago by laszlo.vass.realeyesit.com .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @realeyes/environment-detector 
SYNC missed versions from official npm registry.

Environment Detector

Installation

NPM version

Highlight: flash detection removed from version 2.0

$ npm i --save @realeyes/environment-detector

If you need to detect flash then you should use previous 1.x versions of Environment Detector for example install the latest 1.x

$ npm i --save @realeyes/environment-detector@1.8.6

CDN version

The general format for the script URL is "https://codesdwncdn.realeyesit.com/environment-detector/release/{version}/environment-detector.js". You can specify which kinds of updates your app can accept using semver string in a following format:

  • x.y to receive bug fixes only: https://codesdwncdn.realeyesit.com/environment-detector/release/2.0/environment-detector.min.js
  • x to receive bug fixes and new features (recommended): https://codesdwncdn.realeyesit.com/environment-detector/release/2/environment-detector.min.js
<script src="https://codesdwncdn.realeyesit.com/environment-detector/release/2/environment-detector.min.js"></script>

Self hosted

To create a self-hosted solution you will need to download the library archive https://codesdwncdn.realeyesit.com/environment-detector/release/2/environment-detector.zip. The archive contains the following files:

  • environment-detector.js - Detector library
  • environment-detector.min.js - Minified version
  • index.html - Example page
  • log.gif - Tracking pixel

To use to detector you will need environment-detector.js.

<script src="https://example.com/environment-detector.js"></script>
<script>
Realeyesit.EnvironmentDetector.detect()
    .then(function (result) {
        // result will be an EnvironmentDetectionResult object
    });
</script>

API

The Realeyesit.EnvironmentDetector namespace contains one method: detect(). This method returns a Promise object that resolves with the EnvironmentDetectionResult object. This is the type definition for the EnvironmentDetectionResult:

{
  browser: {
    name: string,
    version: string,
  },
  platform: {
    type: string,
  },
  os: {
    name: string,
    version: string,
  },
  webcams: Array.<string>,
  capabilities: Array.<string>
}
  • browser.name is a string like "Chrome" or "Firefox"
  • browser.version is a version string like "53.0"
  • platform.type is one of "tablet", "mobile" or "desktop"
  • os.name is a string like "windows" or "macos"
  • os.version is a version string like "10.11"
  • webcams is an array of strings, for example ["USB Camera", "iSight"]
  • capabilities is an array of strings

Here is the list of capabilities we can detect:

{
    GET_USER_MEDIA: 'navigator.getUserMedia',
    MEDIA_RECORDER: 'MediaRecorder',
    WEBCAM: 'webcam',
    DOCUMENT_ALL: 'document.all',
    DOCUMENT_QUERY_SELECTOR: 'document.querySelector',
    HTTP: 'http',
    HTTPS: 'https',
}

The detect() method can receive an optional options object with the following type definition:

{
  logger: {
    path: string, // url of the tracking pixel
    disable: boolean, // pass true if you want to disable logging
  } // logger settings
}

Example usage

Realeyesit.EnvironmentDetector.detect()
    .then(function (result) {
        // result will be an EnvironmentDetectionResult object
    });

License

Copyright 2018 Realeyes OU.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Current Tags

  • 2.0.8                                ...           beta (2 years ago)
  • 2.0.20                                ...           latest (4 months ago)
  • 1.8.9                                ...           oldstable (2 years ago)

53 Versions

  • 2.0.20                                ...           4 months ago
  • 2.0.19                                ...           4 months ago
  • 2.0.18                                ...           5 months ago
  • 2.0.17                                ...           8 months ago
  • 2.0.16                                ...           8 months ago
  • 2.0.15                                ...           9 months ago
  • 2.0.14                                ...           a year ago
  • 2.0.13                                ...           a year ago
  • 2.0.12                                ...           a year ago
  • 2.0.10                                ...           a year ago
  • 2.0.8                                ...           2 years ago
  • 1.8.9                                ...           2 years ago
  • 2.0.7                                ...           2 years ago
  • 1.8.8                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.8.6                                ...           2 years ago
  • 1.8.3                                ...           3 years ago
  • 1.8.2                                ...           3 years ago
  • 1.8.1                                ...           3 years ago
  • 1.8.0                                ...           3 years ago
  • 1.7.7                                ...           3 years ago
  • 1.7.6                                ...           3 years ago
  • 1.7.5                                ...           3 years ago
  • 1.7.4                                ...           3 years ago
  • 1.7.3                                ...           3 years ago
  • 1.6.0                                ...           3 years ago
  • 1.5.0                                ...           3 years ago
  • 1.4.1                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.2                                ...           3 years ago
  • 1.3.1                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.12                                ...           3 years ago
  • 1.0.11                                ...           3 years ago
  • 1.0.10                                ...           3 years ago
  • 1.0.9                                ...           3 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 54
Last Day 0
Last Week 54
Last Month 55
Dependencies (6)

Copyright 2014 - 2017 © taobao.org |