Add definition for "pidusage". (#16126)

* Add definition for "throng".

* Fix tslint errors.

* Add definition for "pidusage".

* Remove definition for "throng".

* Fix mistakes.
This commit is contained in:
Cyril Schumacher 2017-04-25 19:28:28 +02:00 committed by Andy
parent 031d1a1b33
commit 4bf3c5c926
4 changed files with 45 additions and 0 deletions

12
types/pidusage/index.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// Type definitions for pidusage 1.1
// Project: https://github.com/soyuka/pidusage
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Stat {
cpu: number;
memory: number;
}
export function stat(pid: number, callback: (error: Error, stat: Stat) => void): void;
export function unmonitor(pid: number): void;

View File

@ -0,0 +1,8 @@
import pusage = require("pidusage");
pusage.stat(0, (err: Error, stat: pusage.Stat) => {
const cpu = stat.cpu;
const memory = stat.memory;
});
pusage.unmonitor(0);

View File

@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"pidusage-tests.ts"
]
}

View File

@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}