useLazyPromise
Sugar for usePromise
This is only a sugar method to call Promise, passing the option for lazy, might not be clear enough.
Parameters
typescript
import { usePromiseLazy } from '@elonehoo/pistachio'
const use = usePromiseLazy(fn, throwException?)
import { usePromiseLazy } from '@elonehoo/pistachio'
const use = usePromiseLazy(fn, throwException?)
Parameters | Type | Required | Default | Description |
---|---|---|---|---|
fn | Function | true | Promise factory | |
throwException | boolean | false | false | Exposes exception on exec() |
State
Check usePromise#State
Methods
Check usePromise#Methods
Implementation
typescript
// this is basically the code for this with no typings
function usePromiseLazy(fn, throwException) {
return usePromise(fn, {
lazy: true,
throwException
})
}
// this is basically the code for this with no typings
function usePromiseLazy(fn, throwException) {
return usePromise(fn, {
lazy: true,
throwException
})
}