-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add mutation for climate settings (#561)
* Add mutation for climate settings * ci: Format code * Format * Add `ClimateModeMenu` * ci: Format code * Hook up mode * Debounce teaser (not working) * ci: Format code * Add debounce function * ci: Format code * ci: Format code * Fix debounce * ci: Format code * ci: Format code * Add status message, hook up mutations * ci: Format code * Remove `console.log`s * Hide unsupported modes * Refactor `getSupportedModes` function * Lint fixes * Apply `delta` * Update `@seamapi/fake-seam-connect` * Update again * Update yet again * Try again... * ci: Format code * Return empty func * Add default `supportedModes` * Narrow default mode * ci: Format code * Format * Use `globalThis` --------- Co-authored-by: Seam Bot <devops@getseam.com>
- Loading branch information
Showing
10 changed files
with
309 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
type Procedure = (...args: any[]) => void | ||
|
||
export function debounce<F extends Procedure>( | ||
func: F, | ||
waitMilliseconds: number | ||
): { | ||
(this: ThisParameterType<F>, ...args: Parameters<F>): void | ||
cancel: () => void | ||
} { | ||
let timeoutId: ReturnType<typeof globalThis.setTimeout> | null = null | ||
|
||
const debouncedFunction = function ( | ||
this: ThisParameterType<F>, | ||
...args: Parameters<F> | ||
): void { | ||
if (timeoutId !== null) { | ||
globalThis.clearTimeout(timeoutId) | ||
} | ||
timeoutId = globalThis.setTimeout(() => { | ||
timeoutId = null | ||
func.apply(this, args) | ||
}, waitMilliseconds) | ||
} | ||
|
||
debouncedFunction.cancel = (): void => { | ||
if (timeoutId !== null) { | ||
globalThis.clearTimeout(timeoutId) | ||
timeoutId = null | ||
} | ||
} | ||
|
||
return debouncedFunction | ||
} |
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
Oops, something went wrong.