Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Lightweight library for composing asynchronous and event-based operations in JavaScript
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.
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);
});
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 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.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.
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.
There are a number of ways to get started with RxJS.
```bash` $ npm install rx-lite $ npm install -g rx-lite
### Using with Node.js and Ringo.js
```js
var Rx = require('rx-lite');
<!-- Just the core RxJS -->
<script src="path/to/rx.lite.js"></script>
Observable Methods
catch | catchException
concat
create | createWithDisposable
defer
empty
from
fromArray
fromCallback
fromEvent
fromEventPattern
fromNodeCallback
fromPromise
interval
just
merge
mergeDelayError
never
of
ofWithScheduler
range
repeat
return | returnValue
throw | throwError | throwException
timer
zip
zipArray
Observable Instance Methods
asObservable
catch | catchException
combineLatest
concat
concatMap
connect
debounce
defaultIfEmpty
delay
dematerialize
distinctUntilChanged
do | doAction
doOnNext
doOnError
doOnCompleted
filter
finally | finallyAction
flatMap
flatMapLatest
ignoreElements
map
merge
mergeObservable | mergeAll
multicast
publish
publishLast
publishValue
refCount
repeat
replay
retry
retryWhen
sample
scan
select
selectConcat
selectMany
selectSwitch
singleInstance
skip
skipLast
skipUntil
skipWhile
startWith
subscribe | forEach
subscribeOnNext
subscribeOnError
subscribeOnCompleted
switch | switchLatest
take
takeLast
takeUntil
takeWhile
tap
tapOnNext
tapOnError
tapOnCompleted
throttle
throttleFirst
timeout
timestamp
toArray
transduce
where
withLatestFrom
zip
Rx.CompositeDisposable
Rx.Disposable
Rx.RefCountDisposable
Rx.SerialDisposable
Rx.SingleAssignmentDisposable
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.
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.
FAQs
Lightweight library for composing asynchronous and event-based operations in JavaScript
The npm package rx-lite receives a total of 1,701,837 weekly downloads. As such, rx-lite popularity was classified as popular.
We found that rx-lite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.