@awesome-cordova-library/device
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

id: plugin-device title: Device tags:

  • cordova
  • capacitor
  • ionic
  • javascript
  • typescript
  • plugin
  • mobile
  • device

Device

This plugin defines a global device object, which describes the device's hardware and software. Although the object is in the global scope, it is not available until after the deviceready event.

Online documentation

Cordova documentation

Installation

Cordova

cordova plugin add cordova-plugin-device
npm install @awesome-cordova-library/device

Capacitor / Ionic

npm install cordova-plugin-device
npm install @awesome-cordova-library/device
npx cap sync

Vanilla

Declaration

class Device {
  static getModel(): string;
  static getPlatform(): string;
  static getVersion(): string;
  static getUuid(): string | null;
  static getManufacturer(): string | null;
  static getIsVirtual(): boolean;
}

Usages

import Device from "@awesome-cordova-library/device";

Device.getModel();
Device.getPlatform();
Device.getVersion();
Device.getUuid();
Device.getManufacturer();
Device.getIsVirtual();

React

Declartion

const useDevice: () => {
  getModel: () => string;
  getPlatform: () => string;
  getUuid: () => string | null;
  getVersion: () => string | null;
  getManufacturer: () => string | null;
};

Usages

import { useEffect } from "react";
import useDevice from "@awesome-cordova-library/device/lib/react";

function App() {
  const { getModel, getPlatform, getUuid, getVersion, getManufacturer } =
    useDevice();

  useEffect(() => {
    getModel();
    getPlatform();
    getUuid();
    getVersion();
    getManufacturer();
  }, []);
}

Package Sidebar

Install

npm i @awesome-cordova-library/device

Weekly Downloads

1

Version

1.0.8

License

SEE LICENSE IN LICENSE

Unpacked Size

14.6 kB

Total Files

7

Last publish

Collaborators

  • joazco