mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-29 19:50:42 +02:00
Merge branch 'dev' into next
This commit is contained in:
@@ -54,13 +54,21 @@ Afterwards all the plugin's APIs are available through the JavaScript guest bind
|
||||
import { watch, watchImmediate } from 'tauri-plugin-fs-watch-api';
|
||||
|
||||
// can also watch an array of paths
|
||||
const stopWatching = await watch('/path/to/something', { recursive: true }, (event) => {
|
||||
const stopWatching = await watch(
|
||||
"/path/to/something",
|
||||
(event) => {
|
||||
const { type, payload } = event;
|
||||
});
|
||||
},
|
||||
{ recursive: true }
|
||||
);
|
||||
|
||||
const stopRawWatcher = await watchImmediate(['/path/a', '/path/b'], {}, (event) => {
|
||||
const stopRawWatcher = await watchImmediate(
|
||||
["/path/a", "/path/b"],
|
||||
(event) => {
|
||||
const { path, operation, cookie } = event;
|
||||
});
|
||||
},
|
||||
{}
|
||||
);
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -44,8 +44,8 @@ async function unwatch(id: number): Promise<void> {
|
||||
|
||||
export async function watch(
|
||||
paths: string | string[],
|
||||
options: DebouncedWatchOptions,
|
||||
cb: (event: DebouncedEvent) => void
|
||||
cb: (event: DebouncedEvent) => void,
|
||||
options: DebouncedWatchOptions = {}
|
||||
): Promise<UnlistenFn> {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
@@ -82,8 +82,8 @@ export async function watch(
|
||||
|
||||
export async function watchImmediate(
|
||||
paths: string | string[],
|
||||
options: WatchOptions,
|
||||
cb: (event: RawEvent) => void
|
||||
cb: (event: RawEvent) => void,
|
||||
options: WatchOptions = {}
|
||||
): Promise<UnlistenFn> {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
|
||||
Reference in New Issue
Block a user