Architecture
This section is for all the developers out there who wish to contribute to this package. This section will help dig deeper in each module. However, if you're learning on how to use this package, you can skip this section.
This section mainly covers the architecture explanations for the different modules in the package. This section refers to the bird eye view of the entire package in detail.
Foundation
The foundation of this entire project is laid with The Clean Architecture by Uncle Bob. Here, the entities are the feature list that are supported by the module. Each module is loosely coupled with other functionalities.
They are all connected through the index.ts
file. Finally, the exposed class WrapperAsync
is enwrapped in a builder pattern to provide the optimal way of configuring functions as per your requirements.
Entities
Modules are referred to as the entities. Each module represents a single entity. Every entity has it's own implementation, and architecture decisions.
Cache
Proxy pattern. Cache module proxies the computed result for the incoming params, and uses that for the next time same params are to be passed.
This is preferred for Pure functions.
Debounce
Singleton Pattern. Debounce module stores a single timeout at any given time. It is then updated in case any update is made within the debounceDelay
.
Publisher
Observer Pattern. Publisher allows you to track events occuring on your promises through subscribing to them.
Retry
Retry module doesn't specifically implement any of the retry patterns, other than the traditional implementation. It retries till the configured retryLimit
, and it will throw an error in case the limit is reached. This implementation gives user the freedom in making the solution more generic.