@reactive-js/rx
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -6,24 +6,3 @@ "use strict"; | ||
this.subscriber = subscriber; | ||
this.drainQueue = shouldYield => { | ||
try { | ||
while (this.nextQueue.length > 0 && !this.subscriber.isDisposed) { | ||
const next = this.nextQueue.shift(); | ||
this.subscriber.next(next); | ||
const yieldRequest = shouldYield(); | ||
const hasMoreEvents = this.remainingEvents > 0; | ||
if (yieldRequest && hasMoreEvents) { | ||
return this.continuation; | ||
} | ||
} | ||
} | ||
catch (cause) { | ||
this.isCompleted = true; | ||
this.error = { cause }; | ||
} | ||
if (this.isCompleted) { | ||
this.subscriber.complete(this.error); | ||
} | ||
return; | ||
}; | ||
this.continuation = { continuation: this.drainQueue }; | ||
this.continuation = { continuation: this }; | ||
this.isCompleted = false; | ||
@@ -55,5 +34,27 @@ this.nextQueue = []; | ||
} | ||
run(shouldYield) { | ||
try { | ||
while (this.nextQueue.length > 0 && !this.subscriber.isDisposed) { | ||
const next = this.nextQueue.shift(); | ||
this.subscriber.next(next); | ||
const yieldRequest = shouldYield(); | ||
const hasMoreEvents = this.remainingEvents > 0; | ||
if (yieldRequest && hasMoreEvents) { | ||
return this.continuation; | ||
} | ||
} | ||
} | ||
catch (cause) { | ||
this.isCompleted = true; | ||
this.error = { cause }; | ||
} | ||
if (this.isCompleted) { | ||
this.subscriber.complete(this.error); | ||
} | ||
return; | ||
} | ||
; | ||
scheduleDrainQueue() { | ||
if (this.remainingEvents === 1) { | ||
this.subscriber.schedule(this.drainQueue); | ||
this.subscriber.schedule(this); | ||
} | ||
@@ -60,0 +61,0 @@ } |
class SafeObserver { | ||
constructor(subscriber) { | ||
this.subscriber = subscriber; | ||
this.drainQueue = shouldYield => { | ||
try { | ||
while (this.nextQueue.length > 0 && !this.subscriber.isDisposed) { | ||
const next = this.nextQueue.shift(); | ||
this.subscriber.next(next); | ||
const yieldRequest = shouldYield(); | ||
const hasMoreEvents = this.remainingEvents > 0; | ||
if (yieldRequest && hasMoreEvents) { | ||
return this.continuation; | ||
} | ||
} | ||
} | ||
catch (cause) { | ||
this.isCompleted = true; | ||
this.error = { cause }; | ||
} | ||
if (this.isCompleted) { | ||
this.subscriber.complete(this.error); | ||
} | ||
return; | ||
}; | ||
this.continuation = { continuation: this.drainQueue }; | ||
this.continuation = { continuation: this }; | ||
this.isCompleted = false; | ||
@@ -52,5 +31,27 @@ this.nextQueue = []; | ||
} | ||
run(shouldYield) { | ||
try { | ||
while (this.nextQueue.length > 0 && !this.subscriber.isDisposed) { | ||
const next = this.nextQueue.shift(); | ||
this.subscriber.next(next); | ||
const yieldRequest = shouldYield(); | ||
const hasMoreEvents = this.remainingEvents > 0; | ||
if (yieldRequest && hasMoreEvents) { | ||
return this.continuation; | ||
} | ||
} | ||
} | ||
catch (cause) { | ||
this.isCompleted = true; | ||
this.error = { cause }; | ||
} | ||
if (this.isCompleted) { | ||
this.subscriber.complete(this.error); | ||
} | ||
return; | ||
} | ||
; | ||
scheduleDrainQueue() { | ||
if (this.remainingEvents === 1) { | ||
this.subscriber.schedule(this.drainQueue); | ||
this.subscriber.schedule(this); | ||
} | ||
@@ -57,0 +58,0 @@ } |
{ | ||
"name": "@reactive-js/rx", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"main": "dist/cjs/index.js", | ||
@@ -41,8 +41,8 @@ "module": "dist/esm5/index.js", | ||
"dependencies": { | ||
"@reactive-js/disposable": "^0.0.17", | ||
"@reactive-js/scheduler": "^0.0.17" | ||
"@reactive-js/disposable": "^0.0.18", | ||
"@reactive-js/scheduler": "^0.0.18" | ||
}, | ||
"devDependencies": { | ||
"@reactive-js/pipe": "^0.0.17", | ||
"@reactive-js/schedulers": "^0.0.17", | ||
"@reactive-js/pipe": "^0.0.18", | ||
"@reactive-js/schedulers": "^0.0.18", | ||
"@types/jest": "^24.0.23", | ||
@@ -72,3 +72,3 @@ "jest": "^24.9.0", | ||
}, | ||
"gitHead": "ad2250c08f04d3d48f0d6db2393444719ed21dc7" | ||
"gitHead": "65fcf45e6866e6aed3c207c90bdd13a09b0961e3" | ||
} |
import { SchedulerContinuationLike } from "@reactive-js/scheduler"; | ||
import { ErrorLike, ObserverLike, SubscriberLike } from "./interfaces"; | ||
class SafeObserver<T> implements ObserverLike<T> { | ||
private readonly drainQueue: SchedulerContinuationLike = shouldYield => { | ||
try { | ||
while (this.nextQueue.length > 0 && !this.subscriber.isDisposed) { | ||
const next = this.nextQueue.shift() as T; | ||
this.subscriber.next(next); | ||
const yieldRequest = shouldYield(); | ||
const hasMoreEvents = this.remainingEvents > 0; | ||
if (yieldRequest && hasMoreEvents) { | ||
return this.continuation; | ||
} | ||
} | ||
} catch (cause) { | ||
this.isCompleted = true; | ||
this.error = { cause }; | ||
} | ||
if (this.isCompleted) { | ||
this.subscriber.complete(this.error); | ||
} | ||
return; | ||
}; | ||
private readonly continuation = { continuation: this.drainQueue }; | ||
class SafeObserver<T> implements ObserverLike<T>, SchedulerContinuationLike { | ||
private readonly continuation = { continuation: this }; | ||
private error: ErrorLike | undefined; | ||
@@ -64,5 +41,29 @@ private isCompleted = false; | ||
run(shouldYield: () => boolean) { | ||
try { | ||
while (this.nextQueue.length > 0 && !this.subscriber.isDisposed) { | ||
const next = this.nextQueue.shift() as T; | ||
this.subscriber.next(next); | ||
const yieldRequest = shouldYield(); | ||
const hasMoreEvents = this.remainingEvents > 0; | ||
if (yieldRequest && hasMoreEvents) { | ||
return this.continuation; | ||
} | ||
} | ||
} catch (cause) { | ||
this.isCompleted = true; | ||
this.error = { cause }; | ||
} | ||
if (this.isCompleted) { | ||
this.subscriber.complete(this.error); | ||
} | ||
return; | ||
} | ||
private scheduleDrainQueue() { | ||
if (this.remainingEvents === 1) { | ||
this.subscriber.schedule(this.drainQueue); | ||
this.subscriber.schedule(this); | ||
} | ||
@@ -69,0 +70,0 @@ } |
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
0
422952
86
1282
+ Added@reactive-js/disposable@0.0.18(transitive)
+ Added@reactive-js/scheduler@0.0.18(transitive)
- Removed@reactive-js/disposable@0.0.17(transitive)
- Removed@reactive-js/scheduler@0.0.17(transitive)