Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@dadajam4/async-combiner
Advanced tools
Service that combines multiple asynchronous requests into one
It was troublesome to implement each project individually to solve the following problems when creating the front-end screen, so I wanted to solve it (I want to make a method that can be used in common).
npm install @dadajam4/async-combiner --save
//
// Class base syntax
//
import { AsyncCombiner } from '@dadajam4/async-combiner';
class SomeClass extends AsyncCombiner {
constructor(someValue1, someValue2) {
super();
this.someValue1 = someValue1;
this.someValue2 = someValue2;
}
someHeavyAsyncFunc(url, query) {
const condition = [url, query];
return this.$asyncCombine(condition, () => this._func(url, query));
}
_someHeavyAsyncFuncExecutor(url, query) {
/**
* @see: https://github.com/axios/axios
*/
return axios.get(url, { params: query });
}
}
import { Combine } from '@dadajam4/async-combiner';
class SomeClass {
// Of course you can also use `class extends`
@Combine()
someHeavyAsyncFunc(url, query) {
/**
* @see: https://github.com/axios/axios
*/
return axios.get(url, { params: query });
}
}
Logic that uses the mechanism of this library should always match the response to the input parameters.
Do not use it for things like get requests that change frequently over time.
Inside the library, the parameters passed to the method are stored as a "condition object", and all requests of the same condition that are triggered before the processing is completed are combined into one execution.
When using the decorator, the parameters passed to the method are automatically converted into a condition object for convenience, but you may want to customize this depending on the condition of the parameter.
You can delay the execution of asynchronous processing if necessary. This feature can significantly reduce the backend service load, depending on the system load.
See the documentation for individual parameter settings.
AbortController
, but I think it is important that it can work with NodeJS as it is, so I would like to think of a way to solve this well.FAQs
Service that combines multiple asynchronous requests into one
The npm package @dadajam4/async-combiner receives a total of 5 weekly downloads. As such, @dadajam4/async-combiner popularity was classified as not popular.
We found that @dadajam4/async-combiner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.