refactor(fs-watch): make options arg optional, closes #3 (#334)

* refactor(fs-watch): make options arg optional, closes #3

* fmt

* readme
pull/337/head
Fabian-Lars 2 years ago committed by GitHub
parent f0fee4f132
commit 92b01ea050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,18 +56,18 @@ 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 { type, payload } = event;
}
},
{ recursive: true }
);
const stopRawWatcher = await watchImmediate(
["/path/a", "/path/b"],
{},
(event) => {
const { path, operation, cookie } = event;
}
},
{}
);
```

@ -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,

Loading…
Cancel
Save