Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsjoins

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsjoins

A JavaScript concurrency library based on the join calculus.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

jsjoins

A JavaScript concurrency library based on the join calculus.

The join calculus is a formal model for message passing concurrency. The name comes from its most powerful feature: join patterns (also known as chords). In the join calculus, programs do not actively request to receive a messages on a certain channel. Instead, they use join patterns, which declaratively specify reactions to specific message patterns (much like method declarations in object-oriented programming). The power of join patterns is that they can be used to atomically process messages from multiple channels.

This project includes a library implementation of join patterns (see src/index.js), as well as a JavaScript syntax extension for declaring channels and join patterns (see src/joinjs.ohm and src/joinjs.js).

Usage

Creating channels:

var joins = require('jsjoins');
var mySyncChannel = joins.Channel();
var myAsyncChannel = joins.AsyncChannel();

Sending messages:

mySyncChannel('hello!');
mySyncChannel({description: 'whatever'});

myAsyncChannel.send('hello!');
myAsyncChannel.send(99);

Join patterns:

joins.when(mySyncChannel).do(function() {
  console.log('simple handler');
});

joins.when(mySyncChannel).and(myAsyncChannel).do(function() {
  return 'value returned to synchronous send';
});

FAQs

Package last updated on 17 Apr 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc