1.0.0 • Published 6 years ago

isov v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

NēoRiven

A Node friendly re-implementation of Riven.

Usage.

This implementation is almost cross-compatible with the original Riven implementation. However, the Node implementation must be done with ES5 classes.

import Riven from 'neo-riven'
const rvn = new Riven()
const { Ø } = rvn.bind()

Ø("bang").create({x:2,y:4},BangNode)
Ø("print").create({x:20,y:4},PrintNode)

Ø("bang").connect("print")
Ø("bang").bang()

class BangNode extends Riven.Node {
	constructor(ctx, id, rect) {
		super(ctx, id, rect)
		this.glyph = Riven.NODE_GLYPHS.bang
	}
}

class PrintNode extends Riven.Node {
	constructor(ctx, id, rect) {
		super(ctx, id, rect)
		this.glyph = Riven.NODE_GLYPHS.render
	}

	receive(q) {
		console.log(q)
	}
}