UNPKG

2.7 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/gaze`
3
4# Summary
5This package contains type definitions for gaze (https://github.com/shama/gaze).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gaze.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gaze/index.d.ts)
10````ts
11// Type definitions for gaze 1.1
12// Project: https://github.com/shama/gaze
13// Definitions by: DefinitelyTyped <https://github.com/DefinitelyTyped>
14// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
15// Minimum TypeScript Version: 3.1
16
17type Mode = 'auto' | 'watch' | 'poll';
18
19interface Options {
20 /**
21 * Interval to pass to fs.watchFile.
22 */
23 interval?: number | undefined;
24 /**
25 * Delay for events called in succession for the same file/event in milliseconds.
26 */
27 debounceDelay?: number | undefined;
28 /**
29 * Force the watch mode. Either 'auto' (default),
30 * 'watch' (force native events), or 'poll' (force stat polling).
31 */
32 mode?: Mode | undefined;
33 /**
34 * The current working directory to base file patterns from. Default is `process.cwd()`.
35 */
36 cwd?: string | undefined;
37}
38
39declare namespace gaze {
40 class Gaze {
41 constructor(
42 patterns: string | string[],
43 options?: Options | null,
44 callback?: (error: Error | null, watcher: Gaze) => void
45 );
46
47 /**
48 * Wrapper for EventEmitter.emit. `added`|`changed`|`renamed`|`deleted` events will also trigger the `all` event.
49 */
50 emit(event: string, ...args: any): boolean;
51
52 /**
53 * Unwatch all files and reset the watch instance.
54 */
55 close(): void;
56
57 /**
58 * Adds file(s) patterns to be watched.
59 */
60 add(patterns: string | string[]): void;
61
62 /**
63 * Removes a file or directory from being watched. Does not recurse directories.
64 */
65 remove(filepath: string): void;
66
67 /**
68 * Returns the currently watched files.
69 */
70 watched(): string[];
71
72 /**
73 * Returns the currently watched files with relative paths.
74 */
75 relative(dir: string, unixify: boolean): string[];
76 }
77}
78
79declare function gaze(
80 patterns: string | string[],
81 options?: Options | null,
82 callback?: (error: Error | null, watcher: gaze.Gaze) => void
83): void;
84
85export = gaze;
86
87````
88
89### Additional Details
90 * Last updated: Thu, 23 Dec 2021 23:34:39 GMT
91 * Dependencies: none
92 * Global values: none
93
94# Credits
95These definitions were written by [DefinitelyTyped](https://github.com/DefinitelyTyped).
96
\No newline at end of file