/colibri

A simple functional reactive library for scala-js

Primary LanguageScalaMIT LicenseMIT

Build Status

Colibri - a simple functional reactive library for scala-js

Usage:

resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "com.github.cornerman.colibri" %%% "colibri" % "master-SNAPSHOT"

For monix support:

libraryDependencies += "com.github.cornerman.colibri" %%% "colibri-monix" % "master-SNAPSHOT"

For scala.rx support:

libraryDependencies += "com.github.cornerman.colibri" %%% "colibri-rx" % "master-SNAPSHOT"

This library includes a minimal frp library and typeclasses for streaming.

We have prepared typeclasses for integrating other streaming libaries:

  • Sink[F[_]] can send values and errors into F has an onNext and onError method.
  • Source[F[_]] can subscribe to F with a Sink (returns a cancelable subscription)
  • CanCancel[T] can cancel T to stop a subscription
  • SubscriptionOwner[T] can let type T own a subscription
  • LiftSink[F[_]] can lift a Sink into type F
  • LiftSource[F[_]] can lift a Source into type F
  • CreateHandler[F[_]] how to create subject in F
  • CreateProHandler[F[_,_]] how to create subject in F which has differnt input/output types.

Most important here are Sink and Source. Source is a typeclass for Observables, Sink is a typeclass for Observers.

Source Code: Source.scala, Sink.scala

Implmentation for Monix

Implmentation for Rx