• Stars
    star
    18
  • Rank 1,165,437 (Top 24 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated 8 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
36
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
10
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

modest

Script/module mode detection while running/loading Lua files. ๐Ÿ” ๐ŸŒ™ โ„น๏ธ ๐Ÿ•ต๏ธโ€โ™‚๏ธ
Shell
2
star
14

Coro-Simple

Simple coroutines for Perl 6, inspired by the Lua coroutines. ๐Ÿ›ค๏ธ ๐Ÿฆ‹ ๐Ÿš‹ ๐Ÿšฆ
Perl 6
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

cuid

CUID generator for Lua. ๐Ÿ†” ๐ŸŒ™ ๐Ÿ”ข โš™๏ธ
Shell
1
star
21

Desafio-React

TypeScript
1
star
22

redis-scripts

My own personal list of custom Lua <=> Redis scripts. ๐Ÿ”ด ๐ŸŒ™ ๐Ÿ“– โš™๏ธ
Lua
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