• Stars
    star
    18
  • Rank 1,204,888 (Top 24 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Composable Concurrency Abstractions for JavaScript. πŸ›€οΈ 🦏 πŸš‹ 🚦

sporadic

Composable Concurrency Abstractions for JavaScript.


Example

#!/usr/bin/env node

(async () => {
  const sporadic = require('sporadic')
  const channel = await sporadic.channels.open()

  const wasReceivedPromise = sporadic.channels.send(channel, "Hello, World!")
  const messagePromise = sporadic.channels.receive(channel)
  const promises = [ wasReceivedPromise, messagePromise ]

  const [ wasReceived, message ] = await Promise.all(promises)
  console.log(wasReceived) // ==> true
  console.log(message) // ==> Hello, World!
})()

Installation

Through UNPKG (for browsers):

<script src="https://unpkg.com/sporadic/dist/index.js"></script>

Through NPM:

$ npm install sporadic

To install the development snapshot, use npm link. For example, on this cloned repository:

$ npm link .

And then, on your project:

$ npm link sporadic

Stable releases are tags in the branch release. The master branch here is only to track the next releases, please don't rely too much on that branch. All the hard work is made on the development branch.

Documentation

For every submodule within this sporadic library, there's an API documentation available at the directory docs/ under the filename SUBMODULE.md, where SUBMODULE stands for the submodule provided with this library (yes, I know the redundancy πŸ˜‚). Each submodule corresponds to a concurrency abstraction. Currently, the following abstractions are implemented:

  • sporadic.streams, an abstraction for reactive streams made of multiple publishers and multiple subscribers. The subscription process is implicit, the reference for the stream object is all that is needed.
  • sporadic.channels, an abstraction for synchronous queues made of many producers and consumers. This concurrent data type is a bare minimal tool for pipelines of chained producers and consumers.
  • sporadic.coroutines, an abstraction for suspendable subroutines. Such abstraction also behaves as a task/promise whenever we wait for the final coroutine result (but keep in mind that coroutines can "loop" forever). It's kinda like the JavaScript generators, with the sole difference of being asynchronous instead synchronous calls (and thus, allowing us to mix asynchronous I/O with that).

Remarks

PRs & Issues are always welcome 🏠! Feel free to open one ✌️! Happy hacking πŸ’»!

License

FOSSA Status

More Repositories

1

spadille

Verifiable/deterministic fair tickets generation for lotteries, raffles and gambling games. 🦏 πŸ€ ♠️ 🎲
JavaScript
44
star
2

twostep

HOTP and TOTP algorithms for 2-step verification (for OCaml). πŸ•™ πŸ” πŸ”’ 🐫
OCaml
20
star
3

ocaml-cuid

CUID generator for OCaml. πŸ†” 🐫 πŸ”’ βš™οΈ
OCaml
18
star
4

moonforth

My own Forth dialect on top of the Lua programming language. [Work in Progress]
Lua
14
star
5

nocoiner

A Commitment Scheme library for Coin Flipping/Tossing algorithms and sort. πŸ€ 🐫 πŸ”’ πŸ”‘
OCaml
11
star
6

hieroglyphs

Quantum-resistant, purely Hash-based, Stateful, One-Time Digital Signatures for OCaml. πŸ›‘οΈ 🐫 πŸ”’ πŸ”‘ [Work In Progress]
OCaml
10
star
7

subtype-refinement

Refinement types encoded with private types in OCaml. πŸ™„ 🐫 πŸ”¬ πŸ“š
OCaml
10
star
8

shared-secret

Abstract (encapsulated) messages or hidden (semi-deterministic) exceptions using OCaml's module system. 🀐 🐫 πŸ”’ βš™οΈ
OCaml
8
star
9

merkle-trees

[WIP] Optimized Merkle Tree algorithm for traversal/verification and path computation. 🌲 πŸ” πŸ”€ 🐫
Reason
4
star
10

talents

Pluggable contextual talents implementation for Lua. 🎨 πŸŒ™ 🎭 πŸ’ƒ
Lua
3
star
11

ownership-disciplines

My own personal list of ownership policies. πŸ”¬ πŸ“š ❓ πŸ€” [Work in Progress]
Ruby
3
star
12

families

Concatenation-based prototypes implementation for Lua. πŸ”¬ πŸŒ™ πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦ 🏑
Lua
3
star
13

Coro-Simple

Simple coroutines for Perl 6, inspired by the Lua coroutines. πŸ›€οΈ πŸ¦‹ πŸš‹ 🚦
Perl 6
2
star
14

modest

Script/module mode detection while running/loading Lua files. πŸ” πŸŒ™ ℹ️ πŸ•΅οΈβ€β™‚οΈ
Shell
2
star
15

instrumental

Financial Instruments encoded as Smart Contracts. πŸ’° 🏦 πŸ“ˆ 🌷 [Work In Progress]
JavaScript
1
star
16

passbase

[WIP] Node.js scripts to generate large datafiles of passwords for cracking tools such as John the Ripper.
JavaScript
1
star
17

gradient

Gradual Typing encoding for Scala.
Scala
1
star
18

CriminalCodeSystem

C#
1
star
19

shareholders

Secret Sharing/Splitting library for OCaml. [Work In Progress]
OCaml
1
star
20

Desafio-React

TypeScript
1
star
21

redis-scripts

My own personal list of custom Lua <=> Redis scripts. πŸ”΄ πŸŒ™ πŸ“– βš™οΈ
Lua
1
star
22

cuid

CUID generator for Lua. πŸ†” πŸŒ™ πŸ”’ βš™οΈ
Shell
1
star
23

rhizome-pass

[Work In Progress] Offline Password Manager (as a PWA) πŸ”‘ 🦏 πŸ“΄ βš™οΈ
TypeScript
1
star
24

perl6-cuid

CUID generator for Perl 6. πŸ†” πŸ¦‹ πŸ”’ βš™οΈ
Perl 6
1
star