Merge branch 'dev' into next

This commit is contained in:
Lucas Nogueira
2023-05-02 13:47:10 -03:00
8 changed files with 86 additions and 20 deletions
+12 -4
View File
@@ -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
+4 -4
View File
@@ -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,