UNPKG

1.46 kBTypeScriptView Raw
1/// <reference types="node" />
2
3import { EventEmitter } from "events";
4import fs = require("graceful-fs");
5import Watcher = require("./Watcher");
6import Watchpack = require(".");
7
8declare class DirectoryWatcher extends EventEmitter {
9 options: Watchpack.WatcherOptions;
10 directories: {
11 [path: string]: Watcher | true;
12 };
13 files: {
14 [path: string]: [number, number];
15 };
16 initialScan: boolean;
17 initialScanRemoved: string[];
18 nestedWatching: boolean;
19 path: string;
20 refs: number;
21 watcher: fs.FSWatcher;
22 watchers: {
23 [path: string]: Watcher[];
24 };
25
26 constructor(directoryPath: string, options: Watchpack.WatcherOptions);
27
28 setFileTime(filePath: string, mtime: number, initial: boolean, type?: string | boolean): void;
29
30 setDirectory(directoryPath: string, exist: boolean, initial: boolean): void;
31
32 createNestedWatcher(directoryPath: string): void;
33
34 setNestedWatching(flag: boolean): void;
35
36 watch(filePath: string, startTime: number): Watcher;
37
38 onFileAdded(filePath: string, stat: fs.Stats): void;
39
40 onDirectoryAdded(directoryPath: string): void;
41
42 onChange(filePath: string, stat: fs.Stats): void;
43
44 onFileUnlinked(filePath: string): void;
45
46 onDirectoryUnlinked(directoryPath: string): void;
47
48 onWatcherError(): void;
49
50 doInitialScan(): void;
51
52 getTimes(): {
53 [path: string]: number;
54 };
55
56 close(): void;
57}
58
59export = DirectoryWatcher;