MetaRx User Manual v0.1.7

Introduction

MetaRx provides reactive data structures for Scala and Scala.js. It is particularly useful in conjunction with user interfaces.

Installation

Add the following dependencies to your build configuration:

libraryDependencies += "pl.metastack" %%  "metarx" % "0.1.7"  // Scala
libraryDependencies += "pl.metastack" %%% "metarx" % "0.1.7"  // Scala.js

Example

The following example illustrates how you can model data flows in MetaRx.

In the first line, we define a channel that takes integer values. We derive from it another channel that increments every value by 1. The === operator in line 3 yields a channel that produces true if the current value is 1, otherwise false.

attach() attaches a callback that is executed for every produced value.

import pl.metastack.metarx._

val ch      = Channel[Int]()
val plusOne = ch.map(_ + 1)
val isOne   = plusOne === 1

isOne.attach(println)

ch := 1
Output:
false

Features

Comparison

MetaRx was developed with simplicity in mind. By design, it doesn’t support back-pressure. It can be used in conjunction with other frameworks such as Akka Streams.

Generated with MetaDocs v0.1.1