What is rx-lite?
The rx-lite npm package is a lightweight version of RxJS, which provides a core set of functionality for reactive programming with observables. It allows developers to compose asynchronous and event-based programs using observable sequences.
What are rx-lite's main functionalities?
Creating Observables
This feature allows the creation of observables. Observables are data streams that can emit multiple values over time, and they are the core abstraction in RxJS.
var Rx = require('rx-lite');
var observable = Rx.Observable.create(function (observer) {
observer.onNext('Hello, World!');
observer.onCompleted();
});
observable.subscribe(function (x) {
console.log(x);
});
Transforming Data Streams
This feature demonstrates the 'map' operator, which transforms each item emitted by an observable by applying a function to it.
var Rx = require('rx-lite');
var source = Rx.Observable.range(1, 5);
var mapped = source.map(function (x) { return x * x; });
mapped.subscribe(function (x) {
console.log(x);
});
Filtering Data Streams
This feature shows the 'filter' operator, which emits only those items from an observable that pass a predicate test.
var Rx = require('rx-lite');
var source = Rx.Observable.from([1, 2, 3, 4, 5]);
var filtered = source.filter(function (x) { return x % 2 === 0; });
filtered.subscribe(function (x) {
console.log(x);
});
Combining Multiple Streams
This feature illustrates how to combine multiple observables into one observable sequence using the 'concat' operator.
var Rx = require('rx-lite');
var stream1 = Rx.Observable.of('Hello');
var stream2 = Rx.Observable.of('World');
var combined = Rx.Observable.concat(stream1, stream2);
combined.subscribe(function (x) {
console.log(x);
});
Other packages similar to rx-lite
rxjs
RxJS is the full version of the reactive programming library for JavaScript. It includes more operators and features than rx-lite, such as advanced composition and utility operators, schedulers, and testing utilities.
xstream
XStream is a library for creating and working with streams of data. It is similar to RxJS but focuses on being more minimal and having a simpler API. It is designed for use with Cycle.js.
most
Most.js is a high-performance reactive programming library. It claims to have superior performance to RxJS and focuses on providing a small core API with composable extensions.
RxJS Lite Module
The Reactive Extensions for JavaScript Lite version is a lightweight version of the Reactive Extensions for JavaScript which covers most of the day to day operators you might use all in a single library. Functionality such as bridging to events, promises, callbacks, Node.js-style callbacks, time-based operations and more are built right in. This comes with rx.lite.js
which is for use in modern development environments such as > IE9 and server-side environments such as Node.js.
Getting Started
There are a number of ways to get started with RxJS.
Installing with NPM
```bash`
$ npm install rx-lite
$ npm install -g rx-lite
### Using with Node.js and Ringo.js
```js
var Rx = require('rx-lite');
In a Browser:
<script src="path/to/rx.lite.js"></script>
Included Observable Operators
Observable Methods
Observable Instance Methods
Included Classes
Core Objects
Subjects
Schedulers
Disposables
Contributing
There are lots of ways to contribute to the project, and we appreciate our contributors. If you wish to contribute, check out our style guide.
You can contribute by reviewing and sending feedback on code checkins, suggesting and trying out new features as they are implemented, submit bugs and help us verify fixes as they are checked in, as well as submit code fixes or code contributions of your own. Note that all code submissions will be rigorously reviewed and tested by the Rx Team, and only those that meet an extremely high bar for both quality and design/roadmap appropriateness will be merged into the source.
License
Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
Microsoft Open Technologies would like to thank its contributors, a list
of whom are at https://github.com/Reactive-Extensions/RxJS/wiki/Contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You may
obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing permissions
and limitations under the License.