mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-01 02:53:03 +08:00
feat(plugin): add Uptime plugin
feat(plugin): add Uptime plugin
This commit is contained in:
commit
4b4eb76352
42
src/@ionic-native/plugins/uptime/index.ts
Normal file
42
src/@ionic-native/plugins/uptime/index.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Uptime
|
||||||
|
* @description
|
||||||
|
* This plugin return the device uptime, without sleep time.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { Uptime } from '@ionic-native/uptime';
|
||||||
|
*
|
||||||
|
* constructor(private uptime: Uptime) { }
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* this.uptime.getUptime()
|
||||||
|
* .then((uptime: any) => console.log(uptime))
|
||||||
|
* .catch((error: any) => console.log(error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
pluginName: 'Uptime',
|
||||||
|
plugin: 'cordova-plugin-uptime',
|
||||||
|
pluginRef: 'Uptime',
|
||||||
|
repo: 'https://github.com/s1lviu/cordova-plugin-uptime',
|
||||||
|
install: '',
|
||||||
|
installVariables: [],
|
||||||
|
platforms: ['Android']
|
||||||
|
})
|
||||||
|
@Injectable()
|
||||||
|
export class Uptime extends IonicNativePlugin {
|
||||||
|
/**
|
||||||
|
* This function return system uptime
|
||||||
|
* @return {Promise<string>} Returns a promise that return the uptime in milliseconds
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
getUptime(): Promise<string> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user