mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat(native): provide FSWatcher
This commit is contained in:
50
packages/native/index.d.ts
vendored
50
packages/native/index.d.ts
vendored
@@ -3,18 +3,42 @@
|
||||
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
export class Storage {
|
||||
constructor(path: string);
|
||||
error(): string | null;
|
||||
getBlob(workspaceId: string | undefined | null, id: string): Promise<Buffer>;
|
||||
connect(workspaceId: string, remote: string): Workspace | null;
|
||||
sync(workspaceId: string, remote: string): Workspace;
|
||||
export interface WatchOptions {
|
||||
recursive?: boolean;
|
||||
}
|
||||
export class Workspace {
|
||||
constructor(id: string);
|
||||
id(): string;
|
||||
clientId(): number;
|
||||
search(query: string): string;
|
||||
getSearchIndex(): Array<string>;
|
||||
setSearchIndex(fields: Array<string>): boolean;
|
||||
/** Watcher kind enumeration */
|
||||
export const enum WatcherKind {
|
||||
/** inotify backend (linux) */
|
||||
Inotify = 'Inotify',
|
||||
/** FS-Event backend (mac) */
|
||||
Fsevent = 'Fsevent',
|
||||
/** KQueue backend (bsd,optionally mac) */
|
||||
Kqueue = 'Kqueue',
|
||||
/** Polling based backend (fallback) */
|
||||
PollWatcher = 'PollWatcher',
|
||||
/** Windows backend */
|
||||
ReadDirectoryChangesWatcher = 'ReadDirectoryChangesWatcher',
|
||||
/** Fake watcher for testing */
|
||||
NullWatcher = 'NullWatcher',
|
||||
Unknown = 'Unknown',
|
||||
}
|
||||
export function watch(
|
||||
p: string,
|
||||
options?: WatchOptions | undefined | null
|
||||
): FSWatcher;
|
||||
export class Subscription {
|
||||
unsubscribe(): void;
|
||||
}
|
||||
export type FSWatcher = FsWatcher;
|
||||
export class FsWatcher {
|
||||
get kind(): WatcherKind;
|
||||
toString(): string;
|
||||
subscribe(
|
||||
callback: (value: any) => any,
|
||||
errorCallback?: (
|
||||
err: Error | null,
|
||||
value: undefined
|
||||
) => any | undefined | null
|
||||
): Subscription;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user