Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Wandalen/wConsequence
Advanced synchronization mechanism. Asynchronous routines may use Consequence to wrap postponed result, what allows classify callback for such routines as output, not input, what improves analyzability of a program. Consequence may be used to make a queue for mutually exclusive access to a resource.
https://github.com/Wandalen/wConsequence
Last synced: 16 days ago
JSON representation
Advanced synchronization mechanism. Asynchronous routines may use Consequence to wrap postponed result, what allows classify callback for such routines as output, not input, what improves analyzability of a program. Consequence may be used to make a queue for mutually exclusive access to a resource.
- Host: GitHub
- URL: https://github.com/Wandalen/wConsequence
- Owner: Wandalen
- License: mit
- Created: 2016-05-31T19:48:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-25T13:09:10.000Z (over 2 years ago)
- Last Synced: 2024-09-24T15:06:00.537Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.63 MB
- Stars: 2
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: License
Awesome Lists containing this project
README
# module::Consequence [![status](https://github.com/Wandalen/wConsequence/actions/workflows/StandardPublish.yml/badge.svg)](https://github.com/Wandalen/wConsequence/actions/workflows/StandardPublish.yml) [![stable](https://img.shields.io/badge/stability-stable-brightgreen.svg)](https://github.com/emersion/stability-badges#stable)
Advanced synchronization mechanism. Asynchronous routines may use Consequence to wrap postponed result, what allows classify callback for such routines as output, not input, what improves analyzability of a program. Consequence may be used to make a queue for mutually exclusive access to a resource.
Algorithmically speaking Consequence is 2 queues ( FIFO ) and a customizable arbitrating algorithm. The first queue contains available resources, the second queue includes competitors for this resources. At any specific moment, one or another queue may be empty or full. Arbitrating algorithm makes resource available for a competitor as soon as possible. There are 2 kinds of resource: regular and erroneous. Unlike Promise, Consequence is much more customizable and can solve engineering problem which Promise cant. But have in mind with great power great responsibility comes. Consequence can coexist and interact with a Promise, getting fulfillment/rejection of a Promise or fulfilling it. Use Consequence to get more flexibility and improve readability of asynchronous aspect of your application.
### Try out from the repository
```
git clone https://github.com/Wandalen/wConsequence
cd wConsequence
will .npm.install
node sample/trivial/Sample.s
```Make sure you have utility `willbe` installed. To install willbe: `npm i -g willbe@stable`. Willbe is required to build of the module.
### To add to your project
```
npm add 'wConsequence@stable'
````Willbe` is not required to use the module in your project as submodule.