default message
autoResetRef
A ref which will be reset to the default value after some time.
Usage
import { autoResetRef } from '@vueuse/core'
const message = autoResetRef('default message', 1000)
const setMessage = () => {
// here the value will change to 'message has set' but after 1000ms, it will change to 'default message'
message.value = 'message has set'
}
Type Declarations
/**
* Create a ref which will be reset to the default value after some time.
*
* @see https://vueuse.org/autoResetRef
* @param defaultValue The value which will be set.
* @param afterMs A zero-or-greater delay in milliseconds.
*/
export declare function autoResetRef<T>(
defaultValue: T,
afterMs?: MaybeRef<number>
): Ref<T>