New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ngx-device-info

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-device-info

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

0.0.8
Source
npm
Version published
Weekly downloads
30
-42.31%
Maintainers
1
Weekly downloads
 
Created
Source

Visit beforepost.com for awesome color palettes & extract colors and text from any source

Device detector / Device info / Permissions info

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

Get device information and more

Live preview

Import

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

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

Using service

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

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

constructor( public device: NgxDeviceInfoService ) {

// this.device. yourmethod()

}

Permissions

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

this.device.getDeviceInfo().then((data) => {
	this.deviceInfo = data;
});
----------------------------------------------
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

this.device.getDeviceInfo().then((data) => {
	this.deviceInfo = data;
});
Methodsusage
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
deviceNamereturns device name
deviceTypereturns device type
userAgentreturns userAgent
languagereturns device language
isOnlinereturns whether internet is on - off
cookieEnabledchecks is cookieEnabled
vendorreturns vendor info
clientHeightInner height of the HTML document body, including padding but not the horizontal scrollbar height, border, or margin
heightDevice screen height (i.e. all physically visible stuff)
availHeightDevice screen height minus the operating system taskbar (if present)
innerHeightThe current document's viewport height, minus taskbars, etc.
outerHeightHeight the current window visibly takes up on screen
clientWidthFull width of the HTML page as coded, minus the vertical scroll bar
widthDevice screen width (i.e. all physically visible stuff)
availWidthDevice screen width, minus the operating system taskbar (if present)
innerWidthThe browser viewport width (including vertical scroll bar, includes padding but not border or margin)
outerWidthThe outer window width (including vertical scroll bar,
hrefreturns location - href
protocolreturns location - protocol
hostreturns location - host
hostnamereturns location - hostname
pathnamereturns location - pathname
searchreturns location - search
hashreturns location - hash
originreturns location - origin
timeZoneOffSetreturns date- timeZoneOffSet
utcStringreturns date- utcString
timereturns date- time
datereturns date- date
dayreturns date- day
monthreturns date- month
hourreturns date- hour
yearreturns date- year
secondsreturns date- seconds
millisecondsreturns date- milliseconds
utcdatereturns date- utcdate
utcdayreturns date- utcday
utcmonthreturns date- utcmonth
utcyearreturns date- utcyear

CDN

CDN Link for ngx-array- https://unpkg.com/ngx-device-info@0.0.7/bundles/ngx-device-info.umd.js

Angular version

This library was generated with Angular CLI version 13.0.0.

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

Author

Thanks in advance

Manojkumar Muthukumar

Coimbatore

Visit beforepost.com for awesome color palettes & extract colors and text from any source

Keywords

angular

FAQs

Package last updated on 02 Jan 2022

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