mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
remove dist dirs from git
This commit is contained in:
-45
@@ -1,45 +0,0 @@
|
||||
import { UnlistenFn } from "@tauri-apps/api/event";
|
||||
export interface WatchOptions {
|
||||
recursive?: boolean;
|
||||
}
|
||||
export interface DebouncedWatchOptions extends WatchOptions {
|
||||
delayMs?: number;
|
||||
}
|
||||
export interface RawEvent {
|
||||
path: string | null;
|
||||
operation: number;
|
||||
cookie: number | null;
|
||||
}
|
||||
export type DebouncedEvent = {
|
||||
type: "NoticeWrite";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "NoticeRemove";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Create";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Write";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Chmod";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Remove";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Rename";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Rescan";
|
||||
payload: null;
|
||||
} | {
|
||||
type: "Error";
|
||||
payload: {
|
||||
error: string;
|
||||
path: string | null;
|
||||
};
|
||||
};
|
||||
export declare function watch(paths: string | string[], options: DebouncedWatchOptions, cb: (event: DebouncedEvent) => void): Promise<UnlistenFn>;
|
||||
export declare function watchImmediate(paths: string | string[], options: WatchOptions, cb: (event: RawEvent) => void): Promise<UnlistenFn>;
|
||||
-72
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-64
@@ -1,64 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { appWindow } from '@tauri-apps/api/window';
|
||||
|
||||
const w = appWindow;
|
||||
async function unwatch(id) {
|
||||
await invoke("plugin:fs-watch|unwatch", { id });
|
||||
}
|
||||
async function watch(paths, options, cb) {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
delayMs: 2000,
|
||||
...options,
|
||||
};
|
||||
let watchPaths;
|
||||
if (typeof paths === "string") {
|
||||
watchPaths = [paths];
|
||||
}
|
||||
else {
|
||||
watchPaths = paths;
|
||||
}
|
||||
const id = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
await invoke("plugin:fs-watch|watch", {
|
||||
id,
|
||||
paths: watchPaths,
|
||||
options: opts,
|
||||
});
|
||||
const unlisten = await w.listen(`watcher://debounced-event/${id}`, (event) => {
|
||||
cb(event.payload);
|
||||
});
|
||||
return () => {
|
||||
void unwatch(id);
|
||||
unlisten();
|
||||
};
|
||||
}
|
||||
async function watchImmediate(paths, options, cb) {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
...options,
|
||||
delayMs: null,
|
||||
};
|
||||
let watchPaths;
|
||||
if (typeof paths === "string") {
|
||||
watchPaths = [paths];
|
||||
}
|
||||
else {
|
||||
watchPaths = paths;
|
||||
}
|
||||
const id = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
await invoke("plugin:fs-watch|watch", {
|
||||
id,
|
||||
paths: watchPaths,
|
||||
options: opts,
|
||||
});
|
||||
const unlisten = await w.listen(`watcher://raw-event/${id}`, (event) => {
|
||||
cb(event.payload);
|
||||
});
|
||||
return () => {
|
||||
void unwatch(id);
|
||||
unlisten();
|
||||
};
|
||||
}
|
||||
|
||||
export { watch, watchImmediate };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA,MAAM,CAAC,GAAkB,SAAS,CAAC;AA2BnC,eAAe,OAAO,CAAC,EAAU,EAAA;IAC/B,MAAM,MAAM,CAAC,yBAAyB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAEM,eAAe,KAAK,CACzB,KAAwB,EACxB,OAA8B,EAC9B,EAAmC,EAAA;AAEnC,IAAA,MAAM,IAAI,GAAG;AACX,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,OAAO,EAAE,IAAI;AAC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