rsocket-flowable
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -9,3 +9,3 @@ /** | ||
* | ||
* | ||
* | ||
*/ | ||
@@ -32,4 +32,4 @@ | ||
/** | ||
* Implements the ReactiveStream `Publisher` interface with Rx-style operators. | ||
*/ | ||
* Implements the ReactiveStream `Publisher` interface with Rx-style operators. | ||
*/ | ||
class Flowable { | ||
@@ -89,4 +89,3 @@ static just(...values) { | ||
return new Flowable(subscriber => | ||
this._source(onSubscribeLift(subscriber)) | ||
); | ||
this._source(onSubscribeLift(subscriber))); | ||
} | ||
@@ -109,4 +108,4 @@ | ||
/** | ||
* @private | ||
*/ | ||
* @private | ||
*/ | ||
class FlowableSubscriber { | ||
@@ -113,0 +112,0 @@ constructor(subscriber, max) { |
@@ -9,3 +9,3 @@ /** | ||
* | ||
* | ||
* | ||
*/ | ||
@@ -23,6 +23,6 @@ | ||
/** | ||
* An operator that acts like Array.map, applying a given function to | ||
* all values provided by its `Subscription` and passing the result to its | ||
* `Subscriber`. | ||
*/ | ||
* An operator that acts like Array.map, applying a given function to | ||
* all values provided by its `Subscription` and passing the result to its | ||
* `Subscriber`. | ||
*/ | ||
class FlowableMapOperator { | ||
@@ -29,0 +29,0 @@ constructor(subscriber, fn) { |
@@ -9,3 +9,3 @@ /** | ||
* | ||
* | ||
* | ||
*/ | ||
@@ -17,5 +17,5 @@ | ||
/** | ||
* An operator that `request()`s the given number of items immediately upon | ||
* being subscribed. | ||
*/ | ||
* An operator that `request()`s the given number of items immediately upon | ||
* being subscribed. | ||
*/ | ||
class FlowableRequestOperator { | ||
@@ -22,0 +22,0 @@ constructor(subscriber, toRequest) { |
@@ -9,3 +9,3 @@ /** | ||
* | ||
* | ||
* | ||
*/ | ||
@@ -23,6 +23,6 @@ | ||
/** | ||
* An operator that requests a fixed number of values from its source | ||
* `Subscription` and forwards them to its `Subscriber`, cancelling the | ||
* subscription when the requested number of items has been reached. | ||
*/ | ||
* An operator that requests a fixed number of values from its source | ||
* `Subscription` and forwards them to its `Subscriber`, cancelling the | ||
* subscription when the requested number of items has been reached. | ||
*/ | ||
class FlowableTakeOperator { | ||
@@ -29,0 +29,0 @@ constructor(subscriber, toTake) { |
@@ -9,3 +9,3 @@ /** | ||
* | ||
* | ||
* | ||
*/ | ||
@@ -22,12 +22,14 @@ | ||
/** | ||
* Returns a Publisher that provides the current time (Date.now()) every `ms` | ||
* milliseconds. | ||
* | ||
* The timer is established on the first call to `request`: on each | ||
* interval a value is published if there are outstanding requests, | ||
* otherwise nothing occurs for that interval. This approach ensures | ||
* that the interval between `onNext` calls is as regular as possible | ||
* and means that overlapping `request` calls (ie calling again before | ||
* the previous values have been vended) behaves consistently. | ||
*/ function every(ms) { | ||
* Returns a Publisher that provides the current time (Date.now()) every `ms` | ||
* milliseconds. | ||
* | ||
* The timer is established on the first call to `request`: on each | ||
* interval a value is published if there are outstanding requests, | ||
* otherwise nothing occurs for that interval. This approach ensures | ||
* that the interval between `onNext` calls is as regular as possible | ||
* and means that overlapping `request` calls (ie calling again before | ||
* the previous values have been vended) behaves consistently. | ||
*/ function every( | ||
ms | ||
) { | ||
return new _Flowable2.default(subscriber => { | ||
@@ -52,10 +54,13 @@ let intervalId = null; | ||
} | ||
intervalId = setInterval(() => { | ||
if (pending > 0) { | ||
if (pending !== Number.MAX_SAFE_INTEGER) { | ||
pending--; | ||
intervalId = setInterval( | ||
() => { | ||
if (pending > 0) { | ||
if (pending !== Number.MAX_SAFE_INTEGER) { | ||
pending--; | ||
} | ||
subscriber.onNext(Date.now()); | ||
} | ||
subscriber.onNext(Date.now()); | ||
} | ||
}, ms); | ||
}, | ||
ms | ||
); | ||
}, | ||
@@ -62,0 +67,0 @@ }); |
@@ -9,3 +9,3 @@ /** | ||
* | ||
* | ||
* | ||
*/ | ||
@@ -15,3 +15,3 @@ | ||
Object.defineProperty(exports, '__esModule', {value: true}); | ||
exports.every = exports.Single = exports.Flowable = undefined; | ||
exports.every = (exports.Single = (exports.Flowable = undefined)); | ||
@@ -28,5 +28,5 @@ var _Flowable = require('./Flowable'); | ||
/** | ||
* The public API of the `flowable` package. | ||
*/ exports.Flowable = _Flowable2.default; | ||
* The public API of the `flowable` package. | ||
*/ exports.Flowable = _Flowable2.default; | ||
exports.Single = _Single2.default; | ||
exports.every = _FlowableTimer.every; |
@@ -9,3 +9,3 @@ /** | ||
* | ||
* | ||
* | ||
*/ | ||
@@ -25,34 +25,34 @@ | ||
/** | ||
* Represents a lazy computation that will either produce a value of type T | ||
* or fail with an error. Calling `subscribe()` starts the | ||
* computation and return a subscription object, which has an `unsubscribe()` | ||
* method that can be called to prevent completion/error callbacks from being | ||
* invoked and, where supported, to also cancel the computation. | ||
* Implementations may optionally implement cancellation; if they do not | ||
* `cancel()` is a no-op. | ||
* | ||
* Note: Unlike Promise, callbacks (onComplete/onError) may be invoked | ||
* synchronously. | ||
* | ||
* Example: | ||
* | ||
* ``` | ||
* const value = new Single(subscriber => { | ||
* const id = setTimeout( | ||
* () => subscriber.onComplete('Hello!'), | ||
* 250 | ||
* ); | ||
* // Optional: Call `onSubscribe` with a cancellation callback | ||
* subscriber.onSubscribe(() => clearTimeout(id)); | ||
* }); | ||
* | ||
* // Start the computation. onComplete will be called after the timeout | ||
* // with 'hello' unless `cancel()` is called first. | ||
* value.subscribe({ | ||
* onComplete: value => console.log(value), | ||
* onError: error => console.error(error), | ||
* onSubscribe: cancel => ... | ||
* }); | ||
* ``` | ||
*/ | ||
* Represents a lazy computation that will either produce a value of type T | ||
* or fail with an error. Calling `subscribe()` starts the | ||
* computation and return a subscription object, which has an `unsubscribe()` | ||
* method that can be called to prevent completion/error callbacks from being | ||
* invoked and, where supported, to also cancel the computation. | ||
* Implementations may optionally implement cancellation; if they do not | ||
* `cancel()` is a no-op. | ||
* | ||
* Note: Unlike Promise, callbacks (onComplete/onError) may be invoked | ||
* synchronously. | ||
* | ||
* Example: | ||
* | ||
* ``` | ||
* const value = new Single(subscriber => { | ||
* const id = setTimeout( | ||
* () => subscriber.onComplete('Hello!'), | ||
* 250 | ||
* ); | ||
* // Optional: Call `onSubscribe` with a cancellation callback | ||
* subscriber.onSubscribe(() => clearTimeout(id)); | ||
* }); | ||
* | ||
* // Start the computation. onComplete will be called after the timeout | ||
* // with 'hello' unless `cancel()` is called first. | ||
* value.subscribe({ | ||
* onComplete: value => console.log(value), | ||
* onError: error => console.error(error), | ||
* onSubscribe: cancel => ... | ||
* }); | ||
* ``` | ||
*/ | ||
class Single { | ||
@@ -115,5 +115,5 @@ static of(value) { | ||
/** | ||
* Return a new Single that resolves to the value of this Single applied to | ||
* the given mapping function. | ||
*/ | ||
* Return a new Single that resolves to the value of this Single applied to | ||
* the given mapping function. | ||
*/ | ||
map(fn) { | ||
@@ -139,4 +139,4 @@ return new Single(subscriber => { | ||
/** | ||
* @private | ||
*/ | ||
* @private | ||
*/ | ||
class FutureSubscriber { | ||
@@ -143,0 +143,0 @@ constructor(subscriber) { |
{ | ||
"name": "rsocket-flowable", | ||
"description": "ReactiveStreams for JavaScript", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
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
143565
16
1235