whenever
Shorthand for watching value to be truthy.
Usage
import { whenever } from '@svelte-use/core'
const ready = writable(false)
when(ready, () => console.log('ready'))
// this
whenever(ready, () => console.log('ready'))
// is equivalent to:
whenever(ready, (isReady) => {
if (isReady) {
console.log('ready')
}
})
Type Declarations
/**
* Shorthand for watching value to be truthy
*
* @see https://svelte-use.vercel.app/shared/whenever
*/
export declare function whenever<T>(
source: MaybeWritable<T>,
cb: Fn
): Unsubscriber