@alextewpin/use-promise
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "@alextewpin/use-promise", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": "Alexander Tewpin <alex.tewpin@gmail.com> (https://github.com/alextewpin)", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -97,8 +97,8 @@ # use-promise | ||
| Parameter | Type | Desrciption | | ||
| -------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | ||
| `promise` | `Promise<Data>` | Promise, that will automatically runned on mount. Mutually exclusive with `promiseThunk`. Dependent on every other parameter. | | ||
| `promiseThunk` | `(payload: Payload) => Promise<Data>` | Function that returns promise, can be called manually with `run`. Mutually exclusive with `promise`. | | ||
| `onResolve` | `(data: Data) => any` | Function that will be called on promise resolution. | | ||
| `onReject` | `(error: Error) => any` | Function that will be called on promise rejection. | | ||
| Parameter | Type | Desrciption | | ||
| --------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | ||
| `promise?` | `Promise<Data>` | Promise, that will automatically runned on mount. Mutually exclusive with `promiseThunk`. Dependent on every other parameter. | | ||
| `promiseThunk?` | `(payload: Payload) => Promise<Data>` | Function that returns promise, can be called manually with `run`. Mutually exclusive with `promise`. | | ||
| `onResolve?` | `(data: Data) => any` | Function that will be called on promise resolution. | | ||
| `onReject?` | `(error: Error) => any` | Function that will be called on promise rejection. | | ||
@@ -109,5 +109,5 @@ ### interface PromiseState<Data, Payload> | ||
| ----------- | ---------------------------- | ---------------------------------------- | | ||
| `data` | `Data \| undefined` | Result of resolved promise. | | ||
| `error` | `Error \| undefined` | Error of rejected promise. | | ||
| `data?` | `Data` | Result of resolved promise. | | ||
| `error?` | `Error` | Error of rejected promise. | | ||
| `isPending` | `boolean` | Promise pending status. | | ||
| `run` | `(payload: Payload) => void` | Run `promiseThunk` with given `Payload`. | |
14462