@reactive-js/rx
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -8,8 +8,5 @@ "use strict"; | ||
try { | ||
const onSubscribeSubscription = onSubscribe(observer); | ||
const onSubscribeSubscription = onSubscribe(observer) || undefined; | ||
if (onSubscribeSubscription !== undefined) { | ||
subscriber.add(onSubscribeSubscription); | ||
if (!(onSubscribeSubscription instanceof Function)) { | ||
onSubscribeSubscription.add(subscriber); | ||
} | ||
} | ||
@@ -16,0 +13,0 @@ } |
@@ -6,8 +6,5 @@ import { createSafeObserver } from "./safeObserver"; | ||
try { | ||
const onSubscribeSubscription = onSubscribe(observer); | ||
const onSubscribeSubscription = onSubscribe(observer) || undefined; | ||
if (onSubscribeSubscription !== undefined) { | ||
subscriber.add(onSubscribeSubscription); | ||
if (!(onSubscribeSubscription instanceof Function)) { | ||
onSubscribeSubscription.add(subscriber); | ||
} | ||
} | ||
@@ -14,0 +11,0 @@ } |
{ | ||
"name": "@reactive-js/rx", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "dist/cjs/index.js", | ||
@@ -41,7 +41,7 @@ "module": "dist/esm5/index.js", | ||
"dependencies": { | ||
"@reactive-js/disposable": "^0.0.5", | ||
"@reactive-js/scheduler": "^0.0.5" | ||
"@reactive-js/disposable": "^0.0.6", | ||
"@reactive-js/scheduler": "^0.0.6" | ||
}, | ||
"devDependencies": { | ||
"@reactive-js/schedulers": "^0.0.5", | ||
"@reactive-js/schedulers": "^0.0.6", | ||
"@types/jest": "^24.0.23", | ||
@@ -71,3 +71,3 @@ "jest": "^24.9.0", | ||
}, | ||
"gitHead": "1a8f6684d73e5529349956ced1b9f29241896d8e" | ||
"gitHead": "de556526ea932ae090f61f71eae15604770ef0a9" | ||
} |
# @reactive-js/rx | ||
Reactive-Js's core reactive programming API. | ||
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. | ||
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. | ||
@@ -13,3 +13,3 @@ 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. | ||
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. | ||
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. | ||
@@ -35,2 +35,3 @@ 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. | ||
## Usage | ||
```typescript | ||
@@ -53,2 +54,2 @@ import { connect } from "@reactive-js/rx"; | ||
API documentation is available [here](./docs). | ||
API documentation is available [here](./docs). |
@@ -27,9 +27,5 @@ import { DisposableOrTeardown } from "@reactive-js/disposable"; | ||
try { | ||
const onSubscribeSubscription = onSubscribe(observer); | ||
const onSubscribeSubscription = onSubscribe(observer) || undefined; | ||
if (onSubscribeSubscription !== undefined) { | ||
subscriber.add(onSubscribeSubscription); | ||
if (!(onSubscribeSubscription instanceof Function)) { | ||
onSubscribeSubscription.add(subscriber); | ||
} | ||
} | ||
@@ -36,0 +32,0 @@ } catch (cause) { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53
78778
1287
+ Added@reactive-js/disposable@0.0.6(transitive)
+ Added@reactive-js/scheduler@0.0.6(transitive)
- Removed@reactive-js/disposable@0.0.5(transitive)
- Removed@reactive-js/scheduler@0.0.5(transitive)