mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add typings for module usage
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/// <reference path="usage.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import usage = require('usage');
|
||||
|
||||
var pid = process.pid;
|
||||
var options = { keepHistory: true };
|
||||
|
||||
usage.lookup(pid, function(err, result) {
|
||||
console.log("Usage infos", result);
|
||||
});
|
||||
|
||||
usage.lookup(pid, options, function (err, result) {
|
||||
console.log("Usage infos with history", result);
|
||||
});
|
||||
|
||||
usage.clearHistory(pid);
|
||||
usage.clearHistory();
|
||||
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for usage
|
||||
// Project: https://github.com/arunoda/node-usage
|
||||
// Definitions by: Pascal Vomhoff <https://github.com/pvomhoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "usage" {
|
||||
|
||||
export interface ResultObject {
|
||||
memory:number;
|
||||
memoryInfo: {
|
||||
rss:number;
|
||||
vsize:number;
|
||||
}
|
||||
cpu:number;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
keepHistory:boolean;
|
||||
}
|
||||
|
||||
export function lookup(pid:number, callback:(err:Error, result:ResultObject) => void);
|
||||
export function lookup(pid:number, options:Options, callback:(err:Error, result:ResultObject) => void);
|
||||
|
||||
//Only availible on linux
|
||||
export function clearHistory(pid?:number);
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user