mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
docs(async): use Array.fromAsync()
in debounce()
example (#4283)
* docs(async): `debounce` example replace with `Array.fromAsync` * Update async/debounce.ts --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
parent
52138c6f99
commit
897b86d99c
@ -26,15 +26,12 @@ export interface DebouncedFunction<T extends Array<unknown>> {
|
||||
* ```
|
||||
* import { debounce } from "https://deno.land/std@$STD_VERSION/async/debounce.ts";
|
||||
*
|
||||
* const log = debounce(
|
||||
* (event: Deno.FsEvent) =>
|
||||
* console.log("[%s] %s", event.kind, event.paths[0]),
|
||||
* 200,
|
||||
* await Array.fromAsync(
|
||||
* Deno.watchFs('./'),
|
||||
* debounce((event) => {
|
||||
* console.log('[%s] %s', event.kind, event.paths[0]);
|
||||
* }, 200),
|
||||
* );
|
||||
*
|
||||
* for await (const event of Deno.watchFs("./")) {
|
||||
* log(event);
|
||||
* }
|
||||
* // wait 200ms ...
|
||||
* // output: Function debounced after 200ms with baz
|
||||
* ```
|
||||
|
Loading…
Reference in New Issue
Block a user