Gathering detailed insights and metrics for rxjs-interop
Gathering detailed insights and metrics for rxjs-interop
Gathering detailed insights and metrics for rxjs-interop
Gathering detailed insights and metrics for rxjs-interop
npm install rxjs-interop
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
8 Stars
64 Commits
4 Watching
6 Branches
2 Contributors
Updated on 23 Aug 2023
TypeScript (99.41%)
Shell (0.59%)
Cumulative downloads
Total Downloads
Last day
-21.3%
9,922
Compared to previous day
Last week
-1.7%
58,460
Compared to previous week
Last month
17.1%
253,068
Compared to previous month
Last year
60.3%
1,870,128
Compared to previous year
A package that contains interop helper functions and types for use with RxJS.
Observables exist independently of RxJS. There are TC39 and WHATWG observable proposals. The helpers in this package make it easy to implement observables that will work with or without RxJS and will still play nice - with RxJS - if Symbol.observable
is not configured.
For more information on RxJS interop, see this blog post.
This package has no dependency on RxJS and is small, but if you want to publish an interop package with no dependencies, just copy the license and the code from this project into yours.
Install the package using NPM:
1npm install rxjs-interop --save
Interop observables expose an observable factory via the Symbol.observable
property, like this:
1export const interop = { 2 [Symbol.observable]: () => { 3 return { 4 subscribe(nextOrObserver, error, complete) { 5 /* figure out whether it's a next callback or an observer */ 6 /* call observer methods */ 7 return () => { /* some teardown logic */ }; 8 } 9 }; 10 } 11});
For this to work with RxJS, the caller will need to initialize Symbol.observable
- which makes things more complicated.
You can use the toObserver
and patch
helpers in this package to more easily implement subscribe
and to make sure that the interop observable will work with RxJS without Symbol.observable
having to be initialized:
1import { patch, toObserver } from "rxjs-interop"; 2 3export const interop = patch({ 4 [Symbol.observable]: () => { 5 return { 6 subscribe(nextOrObserver, error, complete) { 7 const observer = toObserver(nextOrObserver, error, complete); 8 /* call observer methods */ 9 return () => { /* some teardown logic */ }; 10 } 11 }; 12 } 13});
patch
can be passed either an interop observable instance or the constructor of an interop observable class - see the tests for usage.
For an example of how this package can be used to implement things that can be used with or without RxJS, check out Christoph Guttandin's subscribable-things
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More