2016-03-05 03:56:22 +08:00
|
|
|
import {Plugin, CordovaProperty} from './plugin';
|
2015-11-30 07:20:11 +08:00
|
|
|
|
2016-02-17 07:41:45 +08:00
|
|
|
declare var window: {
|
|
|
|
device: Device
|
|
|
|
};
|
2015-11-30 07:20:11 +08:00
|
|
|
|
2016-02-17 07:41:45 +08:00
|
|
|
export interface Device {
|
|
|
|
/** Get the version of Cordova running on the device. */
|
|
|
|
cordova: string;
|
|
|
|
/**
|
|
|
|
* The device.model returns the name of the device's model or product. The value is set
|
|
|
|
* by the device manufacturer and may be different across versions of the same product.
|
|
|
|
*/
|
|
|
|
model: string;
|
|
|
|
/** Get the device's operating system name. */
|
|
|
|
platform: string;
|
|
|
|
/** Get the device's Universally Unique Identifier (UUID). */
|
|
|
|
uuid: string;
|
|
|
|
/** Get the operating system version. */
|
|
|
|
version: string;
|
|
|
|
/** Get the device's manufacturer. */
|
|
|
|
manufacturer: string;
|
|
|
|
/** Whether the device is running on a simulator. */
|
|
|
|
isVirtual: boolean;
|
|
|
|
/** Get the device hardware serial number. */
|
|
|
|
serial: string;
|
|
|
|
}
|
2016-01-26 06:20:36 +08:00
|
|
|
|
|
|
|
/**
|
2016-02-23 05:20:00 +08:00
|
|
|
* @name Device
|
|
|
|
* @description
|
2016-01-26 06:20:36 +08:00
|
|
|
* Access information about the underlying device and platform.
|
|
|
|
*
|
|
|
|
* @usage
|
|
|
|
* ```js
|
2016-03-22 23:04:40 +08:00
|
|
|
* console.log('Device UUID is: ' + Device.device.uuid);
|
2016-01-26 06:20:36 +08:00
|
|
|
* ```
|
|
|
|
*/
|
2015-11-30 07:20:11 +08:00
|
|
|
@Plugin({
|
|
|
|
plugin: 'cordova-plugin-device',
|
2016-02-23 05:20:00 +08:00
|
|
|
pluginRef: 'device',
|
|
|
|
repo: 'https://github.com/apache/cordova-plugin-device'
|
2015-11-30 07:20:11 +08:00
|
|
|
})
|
|
|
|
export class Device {
|
2016-01-26 06:20:36 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the whole device object.
|
2016-02-17 07:41:45 +08:00
|
|
|
*
|
2016-01-26 06:20:36 +08:00
|
|
|
* @returns {Object} The device object.
|
|
|
|
*/
|
2016-03-05 03:56:22 +08:00
|
|
|
@CordovaProperty
|
2016-03-11 05:48:20 +08:00
|
|
|
static get device() { return window.device; }
|
2015-11-30 07:20:11 +08:00
|
|
|
}
|