autoResetState
Category State
A state that automatically resets to the default value after a delay.
Demo
Message : This is the default message
Usage
<script>
import { autoResetState } from '@sv-use/core';
const message = autoResetState('This is the default message', 3000);
function changeMessage() {
// Changes to the default value after 3 seconds
message.current = 'This is the new message';
}
</script>
Type Definitions
/**
* A state that automatically resets to the default value after a delay.
* @param defaultValue The default value of the state (can be an object).
* @param delay The delay in milliseconds.
* @see https://svelte-librarian.github.io/sv-use/docs/core/auto-reset-state
*/
export declare function autoResetState<T>(defaultValue: T, delay?: number): {
current: T;
};