-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implemented search and 'xtask' for Deno
This commit does two things: 1. Implements a minimum viable product of performing search using Elasticlunr. It required some fiddling with Typescript to get it to accept the use of the elasticlunr API, since no types file exists for it. I also made use of a convenient "elem" API created by "char" (https://github.com/char), licensed under the WTFPL. 2. Integrates "deno task dev" with our "cargo xtask site serve" subcommand, to ensure that running local dev builds of the site will automatically rebuild script changes with Deno.
- Loading branch information
1 parent
7155d6e
commit 86bc00e
Showing
11 changed files
with
386 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Debounce an event handler by waiting `waitFor` number of milliseconds before | ||
* permitting the event to be triggered again. | ||
*/ | ||
export function debounce<F extends (...args: Parameters<F>) => ReturnType<F>>( | ||
waitFor: number, | ||
func: F, | ||
): (...args: Parameters<F>) => void { | ||
let timeout: number; | ||
return (...args: Parameters<F>): void => { | ||
clearTimeout(timeout); | ||
timeout = setTimeout(() => func(...args), waitFor); | ||
}; | ||
} |
Oops, something went wrong.