-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
zeit__nsfw.d.ts
52 lines (50 loc) · 1.22 KB
/
zeit__nsfw.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
declare function nsfw(
dir: string,
callback: nsfw.EventsCallback,
options?: nsfw.WatcherOptions,
errorCallback?: (errors: Error[]) => void,
modulePath?: string,
): Promise<nsfw.Watcher>;
declare namespace nsfw {
export class Watcher {
start(): Promise<void>;
stop(): Promise<void>;
}
export interface BaseEvent {
action: nsfw.actions;
directory: string;
};
export interface CreatedEvent extends BaseEvent {
action: nsfw.actions.CREATED;
file: string;
}
export interface DeletedEvent extends BaseEvent {
action: nsfw.actions.DELETED;
file: string;
}
export interface ModifiedEvent extends BaseEvent {
action: nsfw.actions.MODIFIED;
file: string;
}
export interface RenamedEvent extends BaseEvent {
action: nsfw.actions.RENAMED;
oldFile: string;
newDirectory: string;
newFile: string;
}
export type Event = CreatedEvent | DeletedEvent | ModifiedEvent | RenamedEvent;
export type EventsCallback = (events: Event[]) => void;
export interface WatcherOptions {
debouceMS?: number;
errorCallback?(errors: Error[]);
};
export enum actions {
CREATED,
DELETED,
MODIFIED,
RENAMED
};
}
declare module '@zeit/nsfw' {
export = nsfw;
}