Skip to content

theleoborges/rx-cljs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rx-cljs

A ClojureScript wrapper for Reactive Extensions (Rx) for Javascript.

Motivation

The aim of this wrapper is to let developers write this:

(defn project-range [n]
    (return-value (range n)))
    
(-> (from-array [4 6 8])
    (select-many project-range)
    (subscribe #(.log js/console (clj->js %))))

Instead of:

(defn project-range [n]
  (.returnValue js/Rx.Observable (range n)))

(-> (.fromArray js/Rx.Observable
                (clj->js [1 2 3]))
    (.selectMany project-range)
    (.subscribe #(.log js/console (clj->js %))))

Usage

Be warned: it's very early days and this wrapper is still very much incomplete.

For the brave amongst you, add this to your project.clj:

[com.leonardoborges/rx-cljs "0.0.2-SNAPSHOT"]

Or if you're using maven:

<dependency>
  <groupId>com.leonardoborges</groupId>
  <artifactId>rx-cljs</artifactId>
  <version>0.0.2-SNAPSHOT</version>
</dependency>

For a sample app that uses this wrapper, check out this repository.

What's in the package

Creating observables

  • create
  • return-value
  • from-array
  • interval

Working with Observables

  • take
  • map
  • reduce
  • skip
  • zip
  • select-many
  • subscribe
  • start-with
  • buffer-with-count

Working with Connectable observables

  • publish
  • connect
  • ref-count

Working with Observers

  • on-next
  • on-completed

Working with Subscriptions

  • dispose

Running the tests

From the project root:

$ lein cljsbuild test

TODO

Everything else. (but mainly other arities of functions already in here.)

Contributing

Bug reports and pull requests are much welcome. If submitting code, please add a test to it.

License

Copyright (C) 2013 Leonardo Borges

Distributed under the Eclipse Public License, the same as Clojure.

About

A ClojureScript wrapper for RxJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published