Skip to content

Commit

Permalink
docs: updated README.md to reflect latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
teneko committed Nov 25, 2021
1 parent f5f4aaf commit 25927af
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Initially forked from [@adobe/redux-saga-promise](https://github.com/adobe/redux

The library provides:

* Action creators, `promiseActionFactory<PromiseResolveValue>().simple(type)` and `promiseActionFactory<PromiseResolveValue>().advanced(type, prepareAction)` that you can use to define actions which return promises when the pomise middleware has been surpassed. We call an action that returns a promise a *promise action*.
* Action creators, `promiseActionFactory<PromiseResolveValue>().create(type)` and `promiseActionFactory<PromiseResolveValue>().create(type, prepareAction)` that you can use to define actions which return promises when the pomise middleware has been surpassed. We call an action that returns a promise a *promise action*.

* Saga helpers `implementPromiseAction()`, `resolvePromiseAction()`, and`rejectPromiseAction()` that you use to resolve or reject a promise action"s promise.

Expand Down Expand Up @@ -47,13 +47,13 @@ sagaMiddleware.run(rootSaga)

## Creating a promise action:

Create a promise action using `promiseActionFactory<PromiseResolveValue()>().simple(type)` and `promiseActionFactory<PromiseResolveValue()>().advanced(type, prepareAction)` or , analogous to `createAction` from `@reduxjs/toolkit`:
Create a promise action using `promiseActionFactory<PromiseResolveValue()>().create(type)` and `promiseActionFactory<PromiseResolveValue()>().create(type, prepareAction)` or , analogous to `createAction` from `@reduxjs/toolkit`:

```js
import { promiseActionFactory } from "@teroneko/redux-saga-promise"

export const promiseAction = promiseActionFactory<number>().simple("MY_ACTION")
// promiseActionFactory<number>().advanced(type, prepareCreator)
export const promiseAction = promiseActionFactory<number>().create("MY_ACTION")
// promiseActionFactory<number>().create(type, prepareCreator)
```

## Resolving/rejecting the action in a saga:
Expand Down Expand Up @@ -160,7 +160,7 @@ Commonly you want the redux store to reflect the status of a promise action:
whether it"s pending, what the resolved value is, or what the rejected error
is.
Behind the scenes, `promiseAction = promiseActionFactory().simple("MY_ACTION")` actually
Behind the scenes, `promiseAction = promiseActionFactory().create("MY_ACTION")` actually
creates a suite of three actions:
* `promiseAction.trigger`: An alias for `promiseAction`, which is what you dispatch that then creates the promise.
Expand Down Expand Up @@ -225,7 +225,7 @@ Additionally, all the helper functions will throw a custom `Error` subclass `Con
`promiseAction.types ` does not really exist- it only exists as TypeScript-type to make use of `typeof`:

```js
const promiseAction = promiseActionFactory<number>().simple("MY_ACTION");
const promiseAction = promiseActionFactory<number>().create("MY_ACTION");
declare const typeOfTriggerActionThatGotCreatedFromTheSimpleOrAdvancedActionCreator: typeof promiseAction.types.triggerAction;
declare const typeOfResolvedActionThatGotCreatedFromTheSimpleOrAdvancedActionCreator: typeof promiseAction.types.resolvedAction;
Expand Down

0 comments on commit 25927af

Please sign in to comment.