Add npm module progressbar (#14097)

This commit is contained in:
Arne Schubert 2017-01-18 23:30:53 +01:00 committed by Mohamed Hegazy
parent e42960acab
commit 4d4a14359a
4 changed files with 67 additions and 0 deletions

21
progressbar/index.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
// Type definitions for progressbar 1.1
// Project: https://github.com/bevry/progressbar
// Definitions by: Arne Schubert <https://github.com/atd-schubert>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class Progressbar {
step(step: string): this;
getStep(): string;
setStep(steps: string): this;
setTick(ticks: number): this;
addTick(steps?: number): this;
tick(steps?: number): this;
getTick(): number;
setTotal(total: number): this;
total(total: number): this;
addTotal(total?: number): this;
getTotal(): number;
finish(next?: () => void): this;
}
export function create(): Progressbar;

View File

@ -0,0 +1,25 @@
import { Progressbar, create } from 'progressbar';
let str: string = '',
progressbar: Progressbar,
num: number = 1,
fn: () => void = () => {};
progressbar = create();
progressbar = progressbar.step(str);
progressbar = progressbar.setStep(str);
progressbar = progressbar.setTick(num);
progressbar = progressbar.addTick();
progressbar = progressbar.addTick(num);
progressbar = progressbar.tick();
progressbar = progressbar.tick(num);
progressbar = progressbar.setTotal(num);
progressbar = progressbar.total(num);
progressbar = progressbar.addTotal();
progressbar = progressbar.addTotal(num);
progressbar = progressbar.finish(fn);
str = progressbar.getStep();
num = progressbar.getTick();
num = progressbar.getTotal();

20
progressbar/tsconfig.json Normal file
View File

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

1
progressbar/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "../tslint.json" }