-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Hot reloading with chokidar & busting of the require cache. (#515)
* fix: Hot reloading with chokidar & delete require cache. * chore: removed reformatting. * Readme for the hot reloader for esbuild and typescript * feat(hot reload): Hot reload for esbuild and typescript based serverless projects * opted for not changing the default path. * support for url based references in package json files. Co-authored-by: Robb Lovell <[email protected]> Co-authored-by: Matt Strom <[email protected]>
- Loading branch information
1 parent
72670ee
commit 703d1f4
Showing
6 changed files
with
102 additions
and
26 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
export const debounce = | ||
function (func: { (eventName: any, srcPath: any): Promise<void>; apply?: any; }, threshold: number, execAsap: boolean) { | ||
let timeout: any; | ||
return function debounced(this: any) { | ||
const obj = this; | ||
const args = arguments; | ||
|
||
function delayed() { | ||
if (!execAsap) { | ||
func.apply(obj, args); | ||
} | ||
timeout = undefined; | ||
} | ||
|
||
if (timeout) { | ||
clearTimeout(timeout); | ||
} else if (execAsap) { | ||
func.apply(obj, args); | ||
} | ||
timeout = setTimeout(delayed, threshold || 100); | ||
}; | ||
}; |
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