forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pathwatcher.d.ts
90 lines (74 loc) · 2.25 KB
/
pathwatcher.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Type definitions for pathwatcher
// Project: https://github.com/atom/node-pathwatcher
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../q/Q.d.ts" />
declare module PathWatcher {
interface IFileStatic {
new (path:string, symlink?:boolean):IFile;
}
interface IFile {
realPath:string;
path:string;
symlink:boolean;
cachedContents:string;
digest:string;
handleEventSubscriptions():void;
setPath(path:string):void;
getPath():string;
getRealPathSync():string;
getBaseName():string;
write(text:string):void;
readSync(flushCache:boolean):string;
read(flushCache?:boolean):Q.Promise<string>;
// exists():boolean;
existsSync():boolean;
setDigest(contents:string):void;
getDigest():string;
writeFileWithPrivilegeEscalationSync (filePath:string, text:string):void;
handleNativeChangeEvent(eventType:string, eventPath:string):void;
detectResurrectionAfterDelay():void;
detectResurrection():void;
subscribeToNativeChangeEvents():void;
unsubscribeFromNativeChangeEvents():void;
}
interface IDirectoryStatic {
new (path:string, symlink?:boolean):IDirectory;
}
interface IDirectory {
realPath:string;
path:string;
symlink:boolean;
getBaseName():string;
getPath():void;
getRealPathSync():string;
contains(pathToCheck:string):boolean;
relativize(fullPath:string):string;
getEntriesSync():any[]; // return type are {File | Directory}[]
getEntries(callback:Function):void;
subscribeToNativeChangeEvents():void;
unsubscribeFromNativeChangeEvents():void;
isPathPrefixOf(prefix:string, fullPath:string):boolean;
}
}
declare module "pathwatcher" {
import events = require("events");
interface IHandleWatcher extends events.EventEmitter {
onEvent(event:any, filePath:any, oldFilePath:any):any;
start():void;
closeIfNoListener():void;
close():void;
}
interface IPathWatcher {
isWatchingParent:boolean;
path:any;
handleWatcher:IHandleWatcher;
close():void;
}
function watch(path:string, callback:Function):IPathWatcher;
function closeAllWatchers():void;
function getWatchedPaths():string[];
var File:PathWatcher.IFileStatic;
var Directory:PathWatcher.IDirectoryStatic;
}