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

rel-events

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rel-events - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

23

docs/2-HTTP-Events.md

@@ -97,2 +97,25 @@ ## Creating a HTTPEvent

#### Making multiple requests at the same time
If you want to make multiple requests in the same call, instead of returning a single `fetchFromApi` call, you may use [`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) passing a list of `fetchFromApi` calls:
```js
// on eventManagers.js
import { fetchFromApi } from 'rel-events';
export class GetProductsHTTPEventManager {
// ...
call = () => {
return () => Promise.all([ fetchFromApi('/api/products/1'), fetchFromApi('/api/products/2'), ]);
}
// ...
}
```
When all of them are successful, the `onSuccess` handler will be called, and the `event.response` will be an array of `Response` objects. If any of them fails, the `onFailure` handler will be called passing the `Error` instance (most probably a `TypeError: Failed to fetch` error).
---------------
Now that we're done here, maybe you should take a look at some other goodies we have on the Advanced Usage section :)

2

package.json
{
"name": "rel-events",
"version": "0.2.2",
"version": "0.2.3",
"description": "The relevant React Events Library. Events framework based on redux to decouple our from business logic and make state management easy.",

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

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