npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-device-info

v3.0.9

Published

Angular library which provides device information / type / name and also it provides much more device independent features & informations.

Downloads

272

Readme

Device detector / Device info / Permissions info

ngx-device-info npm version ngx-device-info

  • Angular library which provides device information / type / name and also it provides much more device independent features & informations.

  • Get device information and more


Import

Import the module on your app.module.ts file as follow.

import { NgxDeviceInfoModule} from "ngx-device-info";

Add to imports

imports: [
  ...
  NgxDeviceInfoModule
  ...
],

Using service

Import the servie to appropriate component / service file as follows.

import { NgxDeviceInfoService } from 'ngx-device-info';

constructor(public device: NgxDeviceInfoService) {}

Permissions

Get the permission status for following api's - as boolean (true/false):

public deviceInfo: any;

constructor(public device: NgxDeviceInfoService) {
  this.device.getDeviceInfo().then((data) => {
    this.deviceInfo = data;
  });
}

Methods

  • Permission list:
'geolocation',
'notifications',
'push',
'midi',
'camera',
'microphone',
'speaker',
'device-info',
'background-fetch',
'background-sync',
'bluetooth',
'persistent-storage',
'ambient-light-sensor',
'accelerometer',
'gyroscope',
'magnetometer',
'clipboard',
'display-capture',
'nfc',

| Methods | usage | | | --------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | getDeviceName() | returns device specific name | | isDesktop() | returns true if decice is desktop | | isMobile() | returns true if decice is mobile | | isTablet() | returns true if decice is tablet | | getDeviceType() | returns device type mobile - tablet - desktop | | getDeviceInfo() | returns object of info | | | deviceName | returns device name | | | deviceType | returns device type | | | userAgent | returns userAgent | | | language | returns device language | | | isOnline | returns whether internet is on - off | | | cookieEnabled | checks is cookieEnabled | | | vendor | returns vendor info | | | clientHeight | Inner height of the HTML document body, including padding but not the horizontal scrollbar height, border, or margin | | | height | Device screen height (i.e. all physically visible stuff) | | | availHeight | Device screen height minus the operating system taskbar (if present) | | | innerHeight | The current document's viewport height, minus taskbars, etc. | | | outerHeight | Height the current window visibly takes up on screen | | | clientWidth | Full width of the HTML page as coded, minus the vertical scroll bar | | | width | Device screen width (i.e. all physically visible stuff) | | | availWidth | Device screen width, minus the operating system taskbar (if present) | | | innerWidth | The browser viewport width (including vertical scroll bar, includes padding but not border or margin) | | | outerWidth | The outer window width (including vertical scroll bar, | | | href | returns location - href | | | protocol | returns location - protocol | | | host | returns location - host | | | hostname | returns location - hostname | | | pathname | returns location - pathname | | | search | returns location - search | | | hash | returns location - hash | | | origin | returns location - origin | | | timeZoneOffSet | returns date- timeZoneOffSet | | | utcString | returns date- utcString | | | time | returns date- time | | | date | returns date- date | | | day | returns date- day | | | month | returns date- month | | | hour | returns date- hour | | | year | returns date- year | | | seconds | returns date- seconds | | | milliseconds | returns date- milliseconds | | | utcdate | returns date- utcdate | | | utcday | returns date- utcday | | | utcmonth | returns date- utcmonth | | | utcyear | returns date- utcyear |

Code integration

To use this package as a service npm i ngx-device-info install this on the root angular project .

Note: Don't forget to run this commend npm i ngx-device-info on root folder or else it will throw error.

Then import the module as follow on imports array

NgxDeviceInfoModule