Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-awaiter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-awaiter - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

package.json
{
"name": "redux-awaiter",
"version": "0.0.3",
"version": "0.0.4",
"description": "A Redux middleware for giving opportunities to await and receive actions in anywhere",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -12,3 +12,3 @@ # Redux Awaiter

It's inspired by [Redux Saga](https://github.com/redux-saga/redux-saga/), but the problems they solved are totally different.
It's inspired by [Redux Saga](https://github.com/redux-saga/redux-saga/), but the problems they solve are totally different.

@@ -24,8 +24,10 @@ ## Example

fetchUserList();
this.setState(state => ({ ...state, loading: true }));
await take('RECEIVE_USER_LIST');
this.setState(state => ({ ...state, loading: false }));
this.setState(state => ({ ...state, loading: true })); // start loading
await take('RECEIVE_USER_LIST'); // reducers will update `users` in redux store
this.setState(state => ({ ...state, loading: false })); // receive data, stop loading
}
render() {
const { users } = this.props; // `users` is mapped from redux store
const { loading } = this.state;
return (

@@ -37,3 +39,3 @@ <Spin loading={loading}>

</Spin>
)
);
}

@@ -96,3 +98,3 @@ }

```typescript
const take: <P, M = {}>(pattern: Pattern<P, M>) => Promise<Action<P, M>>;
const take: <P = {}, M = {}>(pattern: Pattern<P, M>) => Promise<Action<P, M>>;
```

@@ -110,4 +112,8 @@

`takeAllOf` receives an array of patterns as it single argument, and returns an array of promises.
```typescript
const takeAllOf: <P = {}, M = {}>(patterns: Pattern<P, M>[]) => Promise<Action<P, M>>[];
```
`takeAllOf` receives an array of patterns as its single argument, and returns an array of promises.
Internally, `takeAllOf(patterns)` is the same with `Promise.all(patterns.map(take))`.

@@ -123,4 +129,8 @@

`takeOneOf` receives an array of patterns as it single argument, and returns a promise.
```typescript
const takeOneOf: <P = {}, M = {}>(patterns: Pattern<P, M>[]) => Promise<Action<P, M>>;
```
`takeOneOf` receives an array of patterns as its single argument, and returns a promise.
Internally, `takeOneOf(patterns)` is the same with `Promise.race(patterns.map(take))`.

@@ -127,0 +137,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc