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