1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | type Mode = 'auto' | 'watch' | 'poll';
|
8 |
|
9 | interface Options {
|
10 | |
11 |
|
12 |
|
13 | interval?: number | undefined;
|
14 | |
15 |
|
16 |
|
17 | debounceDelay?: number | undefined;
|
18 | |
19 |
|
20 |
|
21 |
|
22 | mode?: Mode | undefined;
|
23 | |
24 |
|
25 |
|
26 | cwd?: string | undefined;
|
27 | }
|
28 |
|
29 | declare namespace gaze {
|
30 | class Gaze {
|
31 | constructor(
|
32 | patterns: string | string[],
|
33 | options?: Options | null,
|
34 | callback?: (error: Error | null, watcher: Gaze) => void
|
35 | );
|
36 |
|
37 | /**
|
38 | * Wrapper for EventEmitter.emit. `added`|`changed`|`renamed`|`deleted` events will also trigger the `all` event.
|
39 | */
|
40 | emit(event: string, ...args: any): boolean;
|
41 |
|
42 | /**
|
43 | * Unwatch all files and reset the watch instance.
|
44 | */
|
45 | close(): void;
|
46 |
|
47 | /**
|
48 | * Adds file(s) patterns to be watched.
|
49 | */
|
50 | add(patterns: string | string[]): void;
|
51 |
|
52 | /**
|
53 | * Removes a file or directory from being watched. Does not recurse directories.
|
54 | */
|
55 | remove(filepath: string): void;
|
56 |
|
57 | /**
|
58 | * Returns the currently watched files.
|
59 | */
|
60 | watched(): string[];
|
61 |
|
62 | /**
|
63 | * Returns the currently watched files with relative paths.
|
64 | */
|
65 | relative(dir: string, unixify: boolean): string[];
|
66 | }
|
67 | }
|
68 |
|
69 | declare function gaze(
|
70 | patterns: string | string[],
|
71 | options?: Options | null,
|
72 | callback?: (error: Error | null, watcher: gaze.Gaze) => void
|
73 | ): void;
|
74 |
|
75 | export = gaze;
|