forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NProgress.d.ts
116 lines (95 loc) · 3.46 KB
/
NProgress.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Type definitions for NProgress
// Project: https://github.com/rstacruz/nprogress
// Definitions by: Judah Gabriel Himango <http://debuggerdotbreak.wordpress.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface NProgressStatic {
/**
* Shows the progress bar and begins trickling progress.
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
*/
start(): NProgressStatic;
/**
* Finishes loading by transitioning it to 100%, then fading out.
* @param {boolean} forceShow Forces the progress bar to show, even if it's not being shown. (The default behavior is that .done() will not do anything if .start() isn't called.)
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
*/
done(forceShow?: boolean): NProgressStatic;
/**
* Increments the progress bar with a random amount. This will never get to 100%: use it for every image load (or similar).
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
*/
inc(): NProgressStatic;
/**
* Increments the progress bar with a set amount.
* @param {number} amount This will get the current status value and adds the value until status is max 0.994
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
*/
inc(amount: number): NProgressStatic;
/**
* Removes the progress indicator.
*/
remove(): void;
/**
* Sets the progress percentage.
* @param {number} progressPercent A number between 0.0 and 1.0 that represents the progress percentage.
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
*/
set(progressPercent: number): NProgressStatic;
/**
* Configures the progress indicator.
* @param {NProgressConfigureOptions} options An object containing the configuration options.
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
*/
configure(options: NProgressConfigureOptions): NProgressStatic;
/**
* Gets the NProgress version.
*/
version: string;
/**
* Gets the status. If started, it will be the last progress number set.
*/
status: any;
/**
* Gets whether progress has been started.
* @returns {boolean} Whether the progress has started.
*/
isStarted(): boolean;
}
interface NProgressConfigureOptions {
/**
* The minimum progress percentage. Default is 0.08.
*/
minimum?: number;
/**
* How much to increase per trickle. Example: .02. Default is true.
*/
trickleRate?: number;
/**
* How often to trickle, in milliseconds. Default is 800.
*/
trickleSpeed?: number;
/**
* Whether to show the spinner. Defaults to true. Default is true.
*/
showSpinner?: boolean;
/**
* Whether to enable trickling the progress. Default is true.
*/
trickle?: boolean;
/**
* The CSS easing animation to use. Default is 'ease'.
*/
ease?: string;
/**
* The animation speed in milliseconds. Default is 200.
*/
speed?: number;
/**
* The HTML markup inserted for the progress indicator. To keep the progress bar working, keep an element with role='bar' in there.
*/
template?: string;
}
declare var NProgress: NProgressStatic;
declare module "nprogress" {
export = NProgress;
}