Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@reactive-js/rx

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reactive-js/rx - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

test/index.spec.ts

4

dist/cjs/internal/abstractSubscriber.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class AbstractSubscriberImpl {
class AbstractSubscriber {
constructor(scheduler, subscription) {

@@ -33,3 +33,3 @@ this.scheduler = scheduler;

}
exports.AbstractSubscriberImpl = AbstractSubscriberImpl;
exports.AbstractSubscriber = AbstractSubscriber;
exports.checkState = (subscriber) => {

@@ -36,0 +36,0 @@ if (!subscriber.inScheduledContinuation) {

@@ -6,3 +6,3 @@ "use strict";

const __DEV__ = process.env.NODE_ENV !== "production";
class AutoDisposingSubscriber extends abstractSubscriber_1.AbstractSubscriberImpl {
class AutoDisposingSubscriber extends abstractSubscriber_1.AbstractSubscriber {
constructor(scheduler, subscription) {

@@ -9,0 +9,0 @@ super(scheduler, subscription);

@@ -5,3 +5,3 @@ "use strict";

const __DEV__ = process.env.NODE_ENV !== "production";
class DelegatingSubscriber extends abstractSubscriber_1.AbstractSubscriberImpl {
class DelegatingSubscriber extends abstractSubscriber_1.AbstractSubscriber {
constructor(delegate) {

@@ -8,0 +8,0 @@ super(delegate.scheduler || delegate, delegate.subscription || delegate);

@@ -1,2 +0,2 @@

export class AbstractSubscriberImpl {
export class AbstractSubscriber {
constructor(scheduler, subscription) {

@@ -3,0 +3,0 @@ this.scheduler = scheduler;

import { createDisposable } from "@reactive-js/disposable";
import { AbstractSubscriberImpl, checkState } from "./abstractSubscriber";
import { AbstractSubscriber, checkState } from "./abstractSubscriber";
const __DEV__ = process.env.NODE_ENV !== "production";
class AutoDisposingSubscriber extends AbstractSubscriberImpl {
class AutoDisposingSubscriber extends AbstractSubscriber {
constructor(scheduler, subscription) {

@@ -6,0 +6,0 @@ super(scheduler, subscription);

@@ -1,4 +0,4 @@

import { AbstractSubscriberImpl, checkState } from "./abstractSubscriber";
import { AbstractSubscriber, checkState } from "./abstractSubscriber";
const __DEV__ = process.env.NODE_ENV !== "production";
export class DelegatingSubscriber extends AbstractSubscriberImpl {
export class DelegatingSubscriber extends AbstractSubscriber {
constructor(delegate) {

@@ -5,0 +5,0 @@ super(delegate.scheduler || delegate, delegate.subscription || delegate);

import { DisposableLike, DisposableOrTeardown } from "@reactive-js/disposable";
import { SchedulerContinuationLike, SchedulerLike } from "@reactive-js/scheduler";
import { ErrorLike, SubscriberLike } from "./interfaces";
export declare abstract class AbstractSubscriberImpl<T> implements SubscriberLike<T> {
export declare abstract class AbstractSubscriber<T> implements SubscriberLike<T> {
readonly scheduler: SchedulerLike;

@@ -6,0 +6,0 @@ readonly subscription: DisposableLike;

import { ErrorLike, ObserverLike, SubscriberLike } from "./interfaces";
import { AbstractSubscriberImpl } from "./abstractSubscriber";
export declare abstract class DelegatingSubscriber<TA, TB> extends AbstractSubscriberImpl<TA> {
import { AbstractSubscriber } from "./abstractSubscriber";
export declare abstract class DelegatingSubscriber<TA, TB> extends AbstractSubscriber<TA> {
readonly delegate: ObserverLike<TB>;

@@ -5,0 +5,0 @@ private isStopped;

@@ -15,3 +15,3 @@ [@reactive-js/rx](../README.md) › [DelegatingSubscriber](delegatingsubscriber.md)

* AbstractSubscriberImpl‹TA›
* AbstractSubscriber‹TA›

@@ -18,0 +18,0 @@ ↳ **DelegatingSubscriber**

{
"name": "@reactive-js/rx",
"version": "0.0.4",
"version": "0.0.5",
"main": "dist/cjs/index.js",

@@ -8,3 +8,24 @@ "module": "dist/esm5/index.js",

"keywords": [
"rx"
"asynchronous",
"data flow",
"data-flow",
"frp",
"functional programming",
"functional-reactive-programming",
"ix",
"observable",
"observables",
"react",
"reactjs",
"reactive",
"reactive-extensions",
"reactive-js",
"reactive-x",
"rx",
"rxjs",
"scheduler",
"state management",
"state-management",
"stream",
"streams"
],

@@ -21,6 +42,11 @@ "author": {

"dependencies": {
"@reactive-js/disposable": "^0.0.4",
"@reactive-js/scheduler": "^0.0.4",
"tslib": "^1.10.0"
"@reactive-js/disposable": "^0.0.5",
"@reactive-js/scheduler": "^0.0.5"
},
"devDependencies": {
"@reactive-js/schedulers": "^0.0.5",
"@types/jest": "^24.0.23",
"jest": "^24.9.0",
"ts-jest": "^24.1.0"
},
"scripts": {

@@ -31,8 +57,18 @@ "build": "yarn build-cjs & yarn build-esm5 & yarn build-types",

"build-types": "tsc -p tsconfig.types.json",
"docs": "typedoc --tsconfig tsconfig.doc.json"
"docs": "typedoc --tsconfig tsconfig.doc.json",
"test": "jest",
"test-coverage": "jest --coverage"
},
"jest": {
"preset": "ts-jest",
"globals": {
"ts-jest": {
"tsConfig": "./tsconfig.cjs.json"
}
}
},
"publishConfig": {
"access": "public"
},
"gitHead": "482ada60e92db42bf0632396fcde4bc836585e8b"
"gitHead": "1a8f6684d73e5529349956ced1b9f29241896d8e"
}
# @reactive-js/rx
Reactive-Js's core reactive programming API.
This library defines the core interfaces (ObservableLike, ObserverLike, and SubscriberLike) to support an event-driven, reactive, asynchronous programming model. In addition, basic utilities for safely creating and using Observable streams are provided. The [@reactive-js/observable](../observable) library provides additional utilities for creating and transforming observable sources.
Unlike in RxJS, reactive-js Observable streams are always asynchronous. Calling subscribe on an Observable only sets up a subscription, but does not synchronously produce values (doing so is a programming error). Instead, reactive-js deeply integrates scheduling into the Subscriber type. During subscription setup ,Observable sources may schedule work to be done in the future, such as iterating through an iterable source.
Another significant departure from RxJS is the API for subscribing to an Observable. Unlike in RxJS where user code typically directly calls an Observable's subscribe function, in reactive-js user code should use the `connect` function to setup a subscription. The `connect` function requires the user to provide a scheduler. This scheduler is used by the Observable source to schedule both immediate and delayed work, and enables deep integration with platform specific scheduling such as React's internal scheduler.
### A note on backpressure
While reactive-js does not provide an API to directly apply backpressure to an Observable source, the library does provided several primitives that can be used to achieve the effect.
First and foremost, Observable sources are required to schedule the production of values on a Subscriber's Scheduler. Scheduling in reactive-js is designed around cooperative multi-tasking, and Observable sources must honor a Scheduler's `shouldYield` requests, ceasing to produce values, and returning a continuation callback if additional work is to be completed. This is effectively a form of backpressure that can be used to implement timeslicing and improve user experience.
A second approach is provided by the [@reactive-js/ix](../ix) package, which defines interfaces for iterating through asynchronous producers.
## Installation
### via npm
```sh
npm install @reactive-js/rx
```
### via yarn
```sh
yarn add @reactive-js/rx
```
## Usage
```typescript
import { connect } from "@reactive-js/rx";
const observableSource;
const platformScheduler;
// Setup a subscription to the observableSource using the platform scheduler
const subscription = connect(observableSource, platformScheduler);
// ...later in the future
// Dispose the observable subscription
subscription.dispose();
```
## Documentation
API documentation is available [here](./docs).

@@ -9,3 +9,3 @@ import { DisposableLike, DisposableOrTeardown } from "@reactive-js/disposable";

/** @ignore */
export abstract class AbstractSubscriberImpl<T> implements SubscriberLike<T> {
export abstract class AbstractSubscriber<T> implements SubscriberLike<T> {
readonly scheduler: SchedulerLike;

@@ -12,0 +12,0 @@ readonly subscription: DisposableLike;

import { createDisposable, DisposableLike } from "@reactive-js/disposable";
import { SchedulerLike } from "@reactive-js/scheduler";
import { ErrorLike, ObservableLike, SubscriberLike } from "./interfaces";
import { AbstractSubscriberImpl, checkState } from "./abstractSubscriber";
import { AbstractSubscriber, checkState } from "./abstractSubscriber";
const __DEV__ = process.env.NODE_ENV !== "production";
class AutoDisposingSubscriber<T> extends AbstractSubscriberImpl<T>
class AutoDisposingSubscriber<T> extends AbstractSubscriber<T>
implements SubscriberLike<T> {

@@ -10,0 +10,0 @@ private _isConnected = false;

import { ErrorLike, ObserverLike, SubscriberLike } from "./interfaces";
import { AbstractSubscriberImpl, checkState } from "./abstractSubscriber";
import { AbstractSubscriber, checkState } from "./abstractSubscriber";

@@ -11,6 +11,5 @@ const __DEV__ = process.env.NODE_ENV !== "production";

*/
export abstract class DelegatingSubscriber<
TA,
TB
> extends AbstractSubscriberImpl<TA> {
export abstract class DelegatingSubscriber<TA, TB> extends AbstractSubscriber<
TA
> {
readonly delegate: ObserverLike<TB>;

@@ -17,0 +16,0 @@ private isStopped = false;

@@ -42,3 +42,3 @@ import {

private readonly count: number;
private replayed: Notification<T>[] = [];
private readonly replayed: Notification<T>[] = [];
constructor(count: number) {

@@ -45,0 +45,0 @@ this.disposable = createDisposable();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc