An open API service indexing awesome lists of open source software.

https://github.com/theleoborges/rx-cljs

A ClojureScript wrapper for RxJS
https://github.com/theleoborges/rx-cljs

Last synced: 9 months ago
JSON representation

A ClojureScript wrapper for RxJS

Awesome Lists containing this project

README

          

# rx-cljs

A ClojureScript wrapper for [Reactive Extensions (Rx) for Javascript](https://github.com/Reactive-Extensions/RxJS).

## Motivation

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

```clojure
(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:

```clojure
(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`:

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

Or if you're using maven:

```xml

com.leonardoborges
rx-cljs
0.0.2-SNAPSHOT

```

For a sample app that uses this wrapper, check out this [repository](https://github.com/leonardoborges/frp-code).

## 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:

```bash
$ 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](http://www.leonardoborges.com)

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