https://github.com/awto/mfjs-rx
Wraps RxJS iterfece for MFJS compiler
https://github.com/awto/mfjs-rx
monad rx rxjs
Last synced: 4 months ago
JSON representation
Wraps RxJS iterfece for MFJS compiler
- Host: GitHub
- URL: https://github.com/awto/mfjs-rx
- Owner: awto
- License: mit
- Created: 2016-05-14T08:47:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-13T18:00:22.000Z (over 9 years ago)
- Last Synced: 2025-08-08T10:45:23.812Z (5 months ago)
- Topics: monad, rx, rxjs
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @mfjs/rx
The library is intended to be used with
[@mfjs/compiler](https://github.com/awto/mfjs-compiler)
to turn JavaScript into reactive programming language.
## Usage
$ npm install --save-dev @mfjs/compiler
$ npm install --save @mfjs/core rx @mfjs/rx
$ mfjsc input-file.js -o dist
# or for browser
$ npm install --save-dev browserify @mfjs/compiler
$ npm install --save @mfjs/core rx @mfjs/rx
$ browserify -t @mfjs/compiler/monadify input.js -o index.js
Since Observable monad is quite heavy it is better to use the library
with minimal profile where only values wrapped with M are bound.
```javascript
const M = require('@mfjs/core')
const RxM = require('@mfjs/rx')()
RxM.run(function() {
for (let i = 1; i < 4; ++i)
M.yield(i)
M.empty();
})
```
Will return observable signaling 1,2,3.
## Configuration
The call to `require('@mfjs\rx')` returns function for constructing
monad definition object. There are a few options:
* `latest` - by default monad will use flatMap as in original RX .NET LINQ
mapping, but if this field is true it will instead use flatMapLatest
* `exception` - the resulting monad will use `Observable::catch` and
`Observable::handle` functions for encoding try-catch statement.
Or otherwise by default it will use default token based control signaling.
* `wrap` - this option doesn’t change semantics but it wraps Observable into a wrapper
so original Observable prototype isn’t changed.
## License
Copyright © 2016 Vitaliy Akimov
Distributed under the terms of the [The MIT License (MIT)](LICENSE).