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

@reactive-js/observable

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reactive-js/observable - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

4

dist/cjs/index.d.ts

@@ -7,3 +7,3 @@ export { lift } from "./internal/lift";

export { ObservableOperatorLike, SubscriberOperatorLike, } from "./internal/interfaces";
export { iterate, toArray, toIterable, toIterator } from "./internal/iterate";
export { toArray, toIterable } from "./internal/iterate";
export { empty, fromArray, fromScheduledValues, ofValue, } from "./internal/fromArray";

@@ -28,5 +28,5 @@ export { fromIterable } from "./internal/fromIterable";

export { takeWhile } from "./internal/takeWhile";
export { throttleFirst, throttleFirstTime, throttleLast, throttleLastTime, throttle, throttleTime, } from "./internal/throttle";
export { ThrottleMode, throttle } from "./internal/throttle";
export { throws } from "./internal/throws";
export { timeout } from "./internal/timeout";
export { withLatestFrom } from "./internal/withLatestFrom";

@@ -19,6 +19,4 @@ "use strict";

var iterate_1 = require("./internal/iterate");
exports.iterate = iterate_1.iterate;
exports.toArray = iterate_1.toArray;
exports.toIterable = iterate_1.toIterable;
exports.toIterator = iterate_1.toIterator;
var fromArray_1 = require("./internal/fromArray");

@@ -70,8 +68,3 @@ exports.empty = fromArray_1.empty;

var throttle_1 = require("./internal/throttle");
exports.throttleFirst = throttle_1.throttleFirst;
exports.throttleFirstTime = throttle_1.throttleFirstTime;
exports.throttleLast = throttle_1.throttleLast;
exports.throttleLastTime = throttle_1.throttleLastTime;
exports.throttle = throttle_1.throttle;
exports.throttleTime = throttle_1.throttleTime;
var throws_1 = require("./internal/throws");

@@ -78,0 +71,0 @@ exports.throws = throws_1.throws;

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

function combineLatest(...observables) {
const subscribe = (subscriber) => {
const subscribeImpl = (subscriber) => {
const ctx = {

@@ -51,9 +51,9 @@ completedCount: 0,

const observer = new CombineLatestObserver(subscriber, observables.length, allSubscriptions, ctx, index);
observer.innerSubscription = pipe_1.pipe(observables[index], observe_1.observe(observer), rx_1.connect(subscriber));
observer.innerSubscription = pipe_1.pipe(observables[index], observe_1.observe(observer), rx_1.subscribe(subscriber));
allSubscriptions.add(observer.innerSubscription);
}
};
return { subscribe };
return { subscribe: subscribeImpl };
}
exports.combineLatest = combineLatest;
//# sourceMappingURL=combineLatest.js.map

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

function concat(...observables) {
const subscribe = (subscriber) => {
const subscribeImpl = (subscriber) => {
const queue = [...observables];

@@ -16,3 +16,3 @@ let innerSubscription = disposable_1.disposed;

if (head !== undefined) {
innerSubscription = pipe_1.pipe(head, observe_1.observe(observer), rx_1.connect(subscriber));
innerSubscription = pipe_1.pipe(head, observe_1.observe(observer), rx_1.subscribe(subscriber));
subscriber.add(innerSubscription);

@@ -35,3 +35,3 @@ }

};
return { subscribe };
return { subscribe: subscribeImpl };
}

@@ -38,0 +38,0 @@ exports.concat = concat;

@@ -7,20 +7,12 @@ "use strict";

const continuation = shouldYield => {
if (index < values.length && delay > 0) {
while (index < values.length && !subscriber.isDisposed) {
const value = values[index];
index++;
subscriber.next(value);
return continuationResult;
}
else {
while (index < values.length) {
const value = values[index];
index++;
subscriber.next(value);
if (shouldYield()) {
return continuationResult;
}
if (shouldYield() || delay > 0) {
return continuationResult;
}
subscriber.complete();
return;
}
subscriber.complete();
return;
};

@@ -41,3 +33,3 @@ const continuationResult = {

const continuation = (shouldYield) => {
while (index < values.length) {
while (index < values.length && !subscriber.isDisposed) {
const [, value] = values[index];

@@ -44,0 +36,0 @@ index++;

@@ -12,21 +12,10 @@ "use strict";

const continuation = shouldYield => {
let next = iterator.next();
if (next.done) {
subscriber.complete();
return;
}
else if (delay > 0) {
for (let next = iterator.next(); !next.done && !subscriber.isDisposed; next = iterator.next()) {
subscriber.next(next.value);
return continuationResult;
}
else {
for (; !next.done; next = iterator.next()) {
subscriber.next(next.value);
if (shouldYield()) {
return continuationResult;
}
if (shouldYield() || delay !== 0) {
return continuationResult;
}
subscriber.complete();
return;
}
subscriber.complete();
return;
};

@@ -33,0 +22,0 @@ const continuationResult = {

@@ -7,6 +7,4 @@ "use strict";

const continuation = (shouldYield) => {
if (subscriber.isDisposed) {
return;
}
else if (delay > 0) {
do {
subscriber.next(acc);
try {

@@ -19,18 +17,4 @@ acc = generator(acc);

}
subscriber.next(acc);
return continuationResult;
}
else {
do {
try {
acc = generator(acc);
}
catch (cause) {
subscriber.complete({ cause });
return;
}
subscriber.next(acc);
} while (!shouldYield());
return continuationResult;
}
} while (!shouldYield() && !subscriber.isDisposed && delay === 0);
return continuationResult;
};

@@ -37,0 +21,0 @@ const continuationResult = {

import { ObservableLike } from "@reactive-js/rx";
import { VirtualTimeSchedulerResourceLike } from "@reactive-js/schedulers";
import { OperatorLike } from "@reactive-js/pipe";
import { DisposableLike } from "@reactive-js/disposable";
export declare const iterate: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, void>;
export declare const toArray: <T>(schedulerFactory?: (() => VirtualTimeSchedulerResourceLike) | undefined) => OperatorLike<ObservableLike<T>, readonly T[]>;
export interface IteratorResource<T> extends Iterator<T>, DisposableLike {
}
export declare const toIterator: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, IteratorResource<T>>;
export declare const toIterable: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, Iterable<T>>;

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

const disposable_1 = require("@reactive-js/disposable");
exports.iterate = (schedulerFactory = schedulers_1.createSynchronousSchedulerResource) => observable => {
const iterate = (schedulerFactory = schedulers_1.createSynchronousSchedulerResource) => observable => {
const scheduler = schedulerFactory();

@@ -15,3 +15,3 @@ let error = undefined;

error = e;
}), rx_1.connect(scheduler));
}), rx_1.subscribe(scheduler));
scheduler.run();

@@ -30,3 +30,3 @@ scheduler.dispose();

};
pipe_1.pipe(observable, observe_1.onNext(observer), exports.iterate(schedulerFactory));
pipe_1.pipe(observable, observe_1.onNext(observer), iterate(schedulerFactory));
if (result === undefined) {

@@ -46,3 +46,3 @@ throw new Error("Observable did not produce any values");

};
class ObservableIteratorResourceImpl {
class ObservableIteratorImpl {
constructor(scheduler, observable) {

@@ -60,16 +60,7 @@ this.value = undefined;

};
const subscription = pipe_1.pipe(observable, observe_1.observe(observer), rx_1.connect(scheduler));
const subscription = pipe_1.pipe(observable, observe_1.observe(observer), rx_1.subscribe(scheduler));
scheduler.add(subscription);
}
get isDisposed() {
return this.scheduler.isDisposed;
}
add(disposable, ...disposables) {
this.scheduler.add(disposable, ...disposables);
}
dispose() {
this.scheduler.dispose();
}
next() {
disposable_1.throwIfDisposed(this);
disposable_1.throwIfDisposed(this.scheduler);
let done = false;

@@ -85,2 +76,3 @@ do {

if (done) {
this.scheduler.dispose();
return iteratorDone;

@@ -94,7 +86,7 @@ }

return() {
this.dispose();
this.scheduler.dispose();
return iteratorDone;
}
throw(e) {
this.dispose;
this.scheduler.dispose;
if (e !== undefined) {

@@ -105,9 +97,6 @@ throw e;

}
remove(disposable, ...disposables) {
this.scheduler.remove(disposable, ...disposables);
}
}
exports.toIterator = (schedulerFactory = schedulers_1.createSynchronousSchedulerResource) => observable => {
const toIterator = (schedulerFactory = schedulers_1.createSynchronousSchedulerResource) => observable => {
const scheduler = schedulerFactory();
return new ObservableIteratorResourceImpl(scheduler, observable);
return new ObservableIteratorImpl(scheduler, observable);
};

@@ -120,3 +109,3 @@ class IterableObservable {

[Symbol.iterator]() {
return exports.toIterator(this.schedulerFactory)(this.observable);
return toIterator(this.schedulerFactory)(this.observable);
}

@@ -123,0 +112,0 @@ }

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

function merge(...observables) {
const subscribe = (subscriber) => {
const subscribeImpl = (subscriber) => {
const completedCountRef = [0];

@@ -37,9 +37,9 @@ const allSubscriptions = disposable_1.createDisposable();

const observer = new MergeObserver(subscriber, observables.length, completedCountRef, allSubscriptions);
observer.innerSubscription = pipe_1.pipe(observable, observe_1.observe(observer), rx_1.connect(subscriber));
observer.innerSubscription = pipe_1.pipe(observable, observe_1.observe(observer), rx_1.subscribe(subscriber));
allSubscriptions.add(observer.innerSubscription);
}
};
return { subscribe };
return { subscribe: subscribeImpl };
}
exports.merge = merge;
//# sourceMappingURL=merge.js.map

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

this.queue.push(next);
this.connectNext();
this.subscribeNext();
}
}
connectNext() {
subscribeNext() {
if (this.activeCount < this.maxConcurrency) {

@@ -50,6 +50,6 @@ const nextObs = this.queue.shift();

else {
this.connectNext();
this.subscribeNext();
}
},
}), rx_1.connect(this));
}), rx_1.subscribe(this));
this.add(nextObsSubscription);

@@ -56,0 +56,0 @@ }

@@ -45,4 +45,4 @@ "use strict";

},
}), rx_1.connect(scheduler));
}), rx_1.subscribe(scheduler));
});
//# sourceMappingURL=promise.js.map

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

this.count++;
this.parent.innerSubscription.disposable = pipe_1.pipe(this.parent.observable, observe_1.observe(this.parent.observer), rx_1.connect(this.parent));
this.parent.innerSubscription.disposable = pipe_1.pipe(this.parent.observable, observe_1.observe(this.parent.observer), rx_1.subscribe(this.parent));
}

@@ -54,0 +54,0 @@ };

@@ -30,7 +30,7 @@ "use strict";

this.subject = this.factory();
this.sourceSubscription = pipe_1.pipe(this.source, observe_1.observe(this.subject), rx_1.connect(this.scheduler));
this.sourceSubscription = pipe_1.pipe(this.source, observe_1.observe(this.subject), rx_1.subscribe(this.scheduler));
}
this.refCount++;
const subject = this.subject;
const innerSubscription = pipe_1.pipe(subject, observe_1.observe(subscriber), rx_1.connect(subscriber));
const innerSubscription = pipe_1.pipe(subject, observe_1.observe(subscriber), rx_1.subscribe(subscriber));
subscriber.add(this.teardown, innerSubscription);

@@ -37,0 +37,0 @@ }

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

const observe_1 = require("./observe");
exports.subscribeOn = (scheduler) => observable => rx_1.createObservable(observer => pipe_1.pipe(observable, observe_1.observe(observer), rx_1.connect(scheduler)));
exports.subscribeOn = (scheduler) => observable => rx_1.createObservable(observer => pipe_1.pipe(observable, observe_1.observe(observer), rx_1.subscribe(scheduler)));
//# sourceMappingURL=subscribeOn.js.map

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

this.innerSubscription.disposable = disposable_1.disposed;
this.innerSubscription.disposable = pipe_1.pipe(data, observe_1.observe(new SwitchSubscriber.InnerObserver(this)), rx_1.connect(this));
this.innerSubscription.disposable = pipe_1.pipe(data, observe_1.observe(new SwitchSubscriber.InnerObserver(this)), rx_1.subscribe(this));
}

@@ -23,0 +23,0 @@ }

import { ObservableLike } from "@reactive-js/rx";
import { ObservableOperatorLike } from "./interfaces";
export declare const throttleFirst: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleFirstTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const throttleLast: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleLastTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const throttle: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const enum ThrottleMode {
First = 1,
Last = 2,
Interval = 3
}
export declare const throttle: <T>(duration: number | ((next: T) => ObservableLike<unknown>), mode?: ThrottleMode) => ObservableOperatorLike<T, T>;

@@ -9,30 +9,6 @@ "use strict";

const pipe_1 = require("@reactive-js/pipe");
class ThrottleFirstSubscriber extends rx_1.DelegatingSubscriber {
constructor(delegate, durationSelector) {
class ThrottleSubscriber extends rx_1.DelegatingSubscriber {
constructor(delegate, durationSelector, mode) {
super(delegate);
this.durationSubscription = disposable_1.createSerialDisposable();
this.durationSelector = durationSelector;
this.add(this.durationSubscription);
}
onComplete(error) {
this.remove(this.durationSubscription);
this.delegate.complete(error);
}
onNext(data) {
if (this.durationSubscription.disposable.isDisposed) {
this.durationSubscription.disposable = pipe_1.pipe(this.durationSelector(data), rx_1.connect(this));
this.delegate.next(data);
}
}
}
const throttleFirstOperator = (durationSelector) => subscriber => new ThrottleFirstSubscriber(subscriber, durationSelector);
exports.throttleFirst = (durationSelector) => lift_1.lift(throttleFirstOperator(durationSelector));
exports.throttleFirstTime = (duration) => {
const durationSelector = (_) => fromArray_1.empty(duration);
return exports.throttleFirst(durationSelector);
};
class ThrottleLastSubscriber extends rx_1.DelegatingSubscriber {
constructor(delegate, durationSelector) {
super(delegate);
this.durationSubscription = disposable_1.createSerialDisposable();
this.value = undefined;

@@ -44,2 +20,3 @@ this.notifyNext = () => {

const [next] = value;
this.setupDurationSubscription(next);
this.delegate.next(next);

@@ -49,7 +26,11 @@ }

this.durationSelector = durationSelector;
this.mode = mode;
this.add(this.durationSubscription);
}
setupDurationSubscription(next) {
this.durationSubscription.disposable = pipe_1.pipe(this.durationSelector(next), observe_1.onComplete(this.notifyNext), rx_1.subscribe(this));
}
onComplete(error) {
this.remove(this.durationSubscription);
if (error === undefined) {
if (error === undefined && this.mode !== 1) {
this.notifyNext();

@@ -60,51 +41,19 @@ }

onNext(data) {
this.value = [data];
if (this.durationSubscription.disposable.isDisposed) {
this.durationSubscription.disposable = pipe_1.pipe(this.durationSelector(data), observe_1.onComplete(this.notifyNext), rx_1.connect(this));
if (this.value !== undefined) {
this.value[0] = data;
}
}
}
const throttleLastOperator = (durationSelector) => subscriber => new ThrottleLastSubscriber(subscriber, durationSelector);
exports.throttleLast = (durationSelector) => lift_1.lift(throttleLastOperator(durationSelector));
exports.throttleLastTime = (duration) => {
const durationSelector = (_) => fromArray_1.empty(duration);
return exports.throttleLast(durationSelector);
};
class ThrottleSubscriber extends rx_1.DelegatingSubscriber {
constructor(delegate, durationSelector) {
super(delegate);
this.durationSubscription = disposable_1.createSerialDisposable();
this.value = undefined;
this.notifyNext = () => {
const value = this.value;
if (value !== undefined) {
this.value = undefined;
const [next] = value;
this.durationSubscription.disposable = pipe_1.pipe(this.durationSelector(next), observe_1.onComplete(this.notifyNext), rx_1.connect(this));
this.delegate.next(next);
}
};
this.durationSelector = durationSelector;
this.add(this.durationSubscription);
}
onComplete(error) {
this.remove(this.durationSubscription);
if (error === undefined) {
this.notifyNext();
else {
this.value = [data];
}
this.delegate.complete(error);
}
onNext(data) {
this.value = [data];
if (this.durationSubscription.disposable.isDisposed) {
if (this.durationSubscription.disposable.isDisposed &&
this.mode !== 2) {
this.notifyNext();
}
else if (this.durationSubscription.disposable.isDisposed) {
this.setupDurationSubscription(data);
}
}
}
const throttleOperator = (durationSelector) => subscriber => new ThrottleSubscriber(subscriber, durationSelector);
exports.throttle = (durationSelector) => lift_1.lift(throttleOperator(durationSelector));
exports.throttleTime = (duration) => {
const durationSelector = (_) => fromArray_1.empty(duration);
return exports.throttle(durationSelector);
};
const throttleOperator = (durationSelector, mode) => subscriber => new ThrottleSubscriber(subscriber, durationSelector, mode);
exports.throttle = (duration, mode = 3) => lift_1.lift(throttleOperator(typeof duration === "number" ? _ => fromArray_1.empty(duration) : duration, mode));
//# sourceMappingURL=throttle.js.map

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

import { ObservableLike } from "@reactive-js/rx";
import { ObservableOperatorLike } from "./interfaces";
export declare const timeout: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const timeout: <T>(duration: number | ObservableLike<unknown>) => ObservableOperatorLike<T, T>;

@@ -14,5 +14,2 @@ "use strict";

this.durationSubscription = disposable_1.createSerialDisposable();
this.setupTimeout = () => {
this.durationSubscription.disposable = pipe_1.pipe(throws_1.throws(timeoutError, this.duration), observe_1.onError(cause => this.complete({ cause })), rx_1.connect(this));
};
this.duration = duration;

@@ -26,3 +23,3 @@ this.add(this.durationSubscription);

onNext(data) {
this.setupTimeout();
this.durationSubscription.disposable = pipe_1.pipe(this.duration, observe_1.onComplete(error => this.complete(error)), rx_1.subscribe(this));
this.delegate.next(data);

@@ -32,3 +29,3 @@ }

const operator = (duration) => subscriber => new TimeoutSubscriber(subscriber, duration);
exports.timeout = (duration) => lift_1.lift(operator(duration));
exports.timeout = (duration) => lift_1.lift(operator(typeof duration === "number" ? throws_1.throws(timeoutError, duration) : duration));
//# sourceMappingURL=timeout.js.map

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

this.selector = selector;
this.otherSubscription = pipe_1.pipe(other, observe_1.observe(new WithLatestFromSubscriber.InnerObserver(this)), rx_1.connect(this));
this.otherSubscription = pipe_1.pipe(other, observe_1.observe(new WithLatestFromSubscriber.InnerObserver(this)), rx_1.subscribe(this));
this.add(this.otherSubscription);

@@ -14,0 +14,0 @@ }

@@ -7,3 +7,3 @@ export { lift } from "./internal/lift";

export { ObservableOperatorLike, SubscriberOperatorLike, } from "./internal/interfaces";
export { iterate, toArray, toIterable, toIterator } from "./internal/iterate";
export { toArray, toIterable } from "./internal/iterate";
export { empty, fromArray, fromScheduledValues, ofValue, } from "./internal/fromArray";

@@ -28,5 +28,5 @@ export { fromIterable } from "./internal/fromIterable";

export { takeWhile } from "./internal/takeWhile";
export { throttleFirst, throttleFirstTime, throttleLast, throttleLastTime, throttle, throttleTime, } from "./internal/throttle";
export { ThrottleMode, throttle } from "./internal/throttle";
export { throws } from "./internal/throws";
export { timeout } from "./internal/timeout";
export { withLatestFrom } from "./internal/withLatestFrom";

@@ -6,3 +6,3 @@ export { lift } from "./internal/lift";

export { distinctUntilChanged } from "./internal/distinctUntilChanged";
export { iterate, toArray, toIterable, toIterator } from "./internal/iterate";
export { toArray, toIterable } from "./internal/iterate";
export { empty, fromArray, fromScheduledValues, ofValue, } from "./internal/fromArray";

@@ -27,3 +27,3 @@ export { fromIterable } from "./internal/fromIterable";

export { takeWhile } from "./internal/takeWhile";
export { throttleFirst, throttleFirstTime, throttleLast, throttleLastTime, throttle, throttleTime, } from "./internal/throttle";
export { throttle } from "./internal/throttle";
export { throws } from "./internal/throws";

@@ -30,0 +30,0 @@ export { timeout } from "./internal/timeout";

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

import { connect, } from "@reactive-js/rx";
import { subscribe, } from "@reactive-js/rx";
import { createDisposable, disposed, } from "@reactive-js/disposable";

@@ -38,3 +38,3 @@ import { observe } from "./observe";

export function combineLatest(...observables) {
const subscribe = (subscriber) => {
const subscribeImpl = (subscriber) => {
const ctx = {

@@ -49,8 +49,8 @@ completedCount: 0,

const observer = new CombineLatestObserver(subscriber, observables.length, allSubscriptions, ctx, index);
observer.innerSubscription = pipe(observables[index], observe(observer), connect(subscriber));
observer.innerSubscription = pipe(observables[index], observe(observer), subscribe(subscriber));
allSubscriptions.add(observer.innerSubscription);
}
};
return { subscribe };
return { subscribe: subscribeImpl };
}
//# sourceMappingURL=combineLatest.js.map
import { disposed } from "@reactive-js/disposable";
import { connect, } from "@reactive-js/rx";
import { subscribe, } from "@reactive-js/rx";
import { fromArray } from "./fromArray";

@@ -7,3 +7,3 @@ import { observe } from "./observe";

export function concat(...observables) {
const subscribe = (subscriber) => {
const subscribeImpl = (subscriber) => {
const queue = [...observables];

@@ -14,3 +14,3 @@ let innerSubscription = disposed;

if (head !== undefined) {
innerSubscription = pipe(head, observe(observer), connect(subscriber));
innerSubscription = pipe(head, observe(observer), subscribe(subscriber));
subscriber.add(innerSubscription);

@@ -33,3 +33,3 @@ }

};
return { subscribe };
return { subscribe: subscribeImpl };
}

@@ -36,0 +36,0 @@ export function startWith(...values) {

@@ -5,20 +5,12 @@ export const fromArray = (values, delay = 0) => {

const continuation = shouldYield => {
if (index < values.length && delay > 0) {
while (index < values.length && !subscriber.isDisposed) {
const value = values[index];
index++;
subscriber.next(value);
return continuationResult;
}
else {
while (index < values.length) {
const value = values[index];
index++;
subscriber.next(value);
if (shouldYield()) {
return continuationResult;
}
if (shouldYield() || delay > 0) {
return continuationResult;
}
subscriber.complete();
return;
}
subscriber.complete();
return;
};

@@ -39,3 +31,3 @@ const continuationResult = {

const continuation = (shouldYield) => {
while (index < values.length) {
while (index < values.length && !subscriber.isDisposed) {
const [, value] = values[index];

@@ -42,0 +34,0 @@ index++;

@@ -10,21 +10,10 @@ export const fromIterable = (iterable, delay = 0) => {

const continuation = shouldYield => {
let next = iterator.next();
if (next.done) {
subscriber.complete();
return;
}
else if (delay > 0) {
for (let next = iterator.next(); !next.done && !subscriber.isDisposed; next = iterator.next()) {
subscriber.next(next.value);
return continuationResult;
}
else {
for (; !next.done; next = iterator.next()) {
subscriber.next(next.value);
if (shouldYield()) {
return continuationResult;
}
if (shouldYield() || delay !== 0) {
return continuationResult;
}
subscriber.complete();
return;
}
subscriber.complete();
return;
};

@@ -31,0 +20,0 @@ const continuationResult = {

@@ -5,6 +5,4 @@ export const generate = (generator, initialValue, delay = 0) => {

const continuation = (shouldYield) => {
if (subscriber.isDisposed) {
return;
}
else if (delay > 0) {
do {
subscriber.next(acc);
try {

@@ -17,18 +15,4 @@ acc = generator(acc);

}
subscriber.next(acc);
return continuationResult;
}
else {
do {
try {
acc = generator(acc);
}
catch (cause) {
subscriber.complete({ cause });
return;
}
subscriber.next(acc);
} while (!shouldYield());
return continuationResult;
}
} while (!shouldYield() && !subscriber.isDisposed && delay === 0);
return continuationResult;
};

@@ -35,0 +19,0 @@ const continuationResult = {

import { ObservableLike } from "@reactive-js/rx";
import { VirtualTimeSchedulerResourceLike } from "@reactive-js/schedulers";
import { OperatorLike } from "@reactive-js/pipe";
import { DisposableLike } from "@reactive-js/disposable";
export declare const iterate: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, void>;
export declare const toArray: <T>(schedulerFactory?: (() => VirtualTimeSchedulerResourceLike) | undefined) => OperatorLike<ObservableLike<T>, readonly T[]>;
export interface IteratorResource<T> extends Iterator<T>, DisposableLike {
}
export declare const toIterator: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, IteratorResource<T>>;
export declare const toIterable: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, Iterable<T>>;

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

import { connect, } from "@reactive-js/rx";
import { subscribe, } from "@reactive-js/rx";
import { createSynchronousSchedulerResource, } from "@reactive-js/schedulers";

@@ -6,4 +6,4 @@ import { observe, onComplete, onNext } from "./observe";

import { pipe } from "@reactive-js/pipe";
import { throwIfDisposed, } from "@reactive-js/disposable";
export const iterate = (schedulerFactory = createSynchronousSchedulerResource) => observable => {
import { throwIfDisposed } from "@reactive-js/disposable";
const iterate = (schedulerFactory = createSynchronousSchedulerResource) => observable => {
const scheduler = schedulerFactory();

@@ -13,3 +13,3 @@ let error = undefined;

error = e;
}), connect(scheduler));
}), subscribe(scheduler));
scheduler.run();

@@ -43,3 +43,3 @@ scheduler.dispose();

};
class ObservableIteratorResourceImpl {
class ObservableIteratorImpl {
constructor(scheduler, observable) {

@@ -57,16 +57,7 @@ this.value = undefined;

};
const subscription = pipe(observable, observe(observer), connect(scheduler));
const subscription = pipe(observable, observe(observer), subscribe(scheduler));
scheduler.add(subscription);
}
get isDisposed() {
return this.scheduler.isDisposed;
}
add(disposable, ...disposables) {
this.scheduler.add(disposable, ...disposables);
}
dispose() {
this.scheduler.dispose();
}
next() {
throwIfDisposed(this);
throwIfDisposed(this.scheduler);
let done = false;

@@ -82,2 +73,3 @@ do {

if (done) {
this.scheduler.dispose();
return iteratorDone;

@@ -91,7 +83,7 @@ }

return() {
this.dispose();
this.scheduler.dispose();
return iteratorDone;
}
throw(e) {
this.dispose;
this.scheduler.dispose;
if (e !== undefined) {

@@ -102,9 +94,6 @@ throw e;

}
remove(disposable, ...disposables) {
this.scheduler.remove(disposable, ...disposables);
}
}
export const toIterator = (schedulerFactory = createSynchronousSchedulerResource) => observable => {
const toIterator = (schedulerFactory = createSynchronousSchedulerResource) => observable => {
const scheduler = schedulerFactory();
return new ObservableIteratorResourceImpl(scheduler, observable);
return new ObservableIteratorImpl(scheduler, observable);
};

@@ -111,0 +100,0 @@ class IterableObservable {

import { createDisposable, disposed, } from "@reactive-js/disposable";
import { connect, } from "@reactive-js/rx";
import { subscribe, } from "@reactive-js/rx";
import { observe } from "./observe";

@@ -28,3 +28,3 @@ import { pipe } from "@reactive-js/pipe";

export function merge(...observables) {
const subscribe = (subscriber) => {
const subscribeImpl = (subscriber) => {
const completedCountRef = [0];

@@ -35,8 +35,8 @@ const allSubscriptions = createDisposable();

const observer = new MergeObserver(subscriber, observables.length, completedCountRef, allSubscriptions);
observer.innerSubscription = pipe(observable, observe(observer), connect(subscriber));
observer.innerSubscription = pipe(observable, observe(observer), subscribe(subscriber));
allSubscriptions.add(observer.innerSubscription);
}
};
return { subscribe };
return { subscribe: subscribeImpl };
}
//# sourceMappingURL=merge.js.map

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

import { connect, DelegatingSubscriber, } from "@reactive-js/rx";
import { subscribe, DelegatingSubscriber, } from "@reactive-js/rx";
import { lift } from "./lift";

@@ -27,6 +27,6 @@ import { observe } from "./observe";

this.queue.push(next);
this.connectNext();
this.subscribeNext();
}
}
connectNext() {
subscribeNext() {
if (this.activeCount < this.maxConcurrency) {

@@ -48,6 +48,6 @@ const nextObs = this.queue.shift();

else {
this.connectNext();
this.subscribeNext();
}
},
}), connect(this));
}), subscribe(this));
this.add(nextObsSubscription);

@@ -54,0 +54,0 @@ }

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

import { connect, createObservable, } from "@reactive-js/rx";
import { subscribe, createObservable, } from "@reactive-js/rx";
import { observe } from "./observe";

@@ -43,4 +43,4 @@ import { pipe } from "@reactive-js/pipe";

},
}), connect(scheduler));
}), subscribe(scheduler));
});
//# sourceMappingURL=promise.js.map
import { createSerialDisposable, } from "@reactive-js/disposable";
import { connect, DelegatingSubscriber, } from "@reactive-js/rx";
import { subscribe, DelegatingSubscriber, } from "@reactive-js/rx";
import { lift } from "./lift";

@@ -49,3 +49,3 @@ import { observe } from "./observe";

this.count++;
this.parent.innerSubscription.disposable = pipe(this.parent.observable, observe(this.parent.observer), connect(this.parent));
this.parent.innerSubscription.disposable = pipe(this.parent.observable, observe(this.parent.observer), subscribe(this.parent));
}

@@ -52,0 +52,0 @@ };

import { disposed } from "@reactive-js/disposable";
import { connect, createSubject, } from "@reactive-js/rx";
import { subscribe, createSubject, } from "@reactive-js/rx";
import { observe } from "./observe";

@@ -28,7 +28,7 @@ import { pipe } from "@reactive-js/pipe";

this.subject = this.factory();
this.sourceSubscription = pipe(this.source, observe(this.subject), connect(this.scheduler));
this.sourceSubscription = pipe(this.source, observe(this.subject), subscribe(this.scheduler));
}
this.refCount++;
const subject = this.subject;
const innerSubscription = pipe(subject, observe(subscriber), connect(subscriber));
const innerSubscription = pipe(subject, observe(subscriber), subscribe(subscriber));
subscriber.add(this.teardown, innerSubscription);

@@ -35,0 +35,0 @@ }

import { pipe } from "@reactive-js/pipe";
import { connect, createObservable } from "@reactive-js/rx";
import { subscribe, createObservable } from "@reactive-js/rx";
import { observe } from "./observe";
export const subscribeOn = (scheduler) => observable => createObservable(observer => pipe(observable, observe(observer), connect(scheduler)));
export const subscribeOn = (scheduler) => observable => createObservable(observer => pipe(observable, observe(observer), subscribe(scheduler)));
//# sourceMappingURL=subscribeOn.js.map
import { createSerialDisposable, disposed } from "@reactive-js/disposable";
import { connect, DelegatingSubscriber, } from "@reactive-js/rx";
import { subscribe, DelegatingSubscriber, } from "@reactive-js/rx";
import { lift } from "./lift";

@@ -18,3 +18,3 @@ import { observe } from "./observe";

this.innerSubscription.disposable = disposed;
this.innerSubscription.disposable = pipe(data, observe(new SwitchSubscriber.InnerObserver(this)), connect(this));
this.innerSubscription.disposable = pipe(data, observe(new SwitchSubscriber.InnerObserver(this)), subscribe(this));
}

@@ -21,0 +21,0 @@ }

import { ObservableLike } from "@reactive-js/rx";
import { ObservableOperatorLike } from "./interfaces";
export declare const throttleFirst: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleFirstTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const throttleLast: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleLastTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const throttle: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const enum ThrottleMode {
First = 1,
Last = 2,
Interval = 3
}
export declare const throttle: <T>(duration: number | ((next: T) => ObservableLike<unknown>), mode?: ThrottleMode) => ObservableOperatorLike<T, T>;
import { createSerialDisposable, } from "@reactive-js/disposable";
import { connect, DelegatingSubscriber, } from "@reactive-js/rx";
import { subscribe, DelegatingSubscriber, } from "@reactive-js/rx";
import { empty } from "./fromArray";

@@ -7,30 +7,6 @@ import { lift } from "./lift";

import { pipe } from "@reactive-js/pipe";
class ThrottleFirstSubscriber extends DelegatingSubscriber {
constructor(delegate, durationSelector) {
class ThrottleSubscriber extends DelegatingSubscriber {
constructor(delegate, durationSelector, mode) {
super(delegate);
this.durationSubscription = createSerialDisposable();
this.durationSelector = durationSelector;
this.add(this.durationSubscription);
}
onComplete(error) {
this.remove(this.durationSubscription);
this.delegate.complete(error);
}
onNext(data) {
if (this.durationSubscription.disposable.isDisposed) {
this.durationSubscription.disposable = pipe(this.durationSelector(data), connect(this));
this.delegate.next(data);
}
}
}
const throttleFirstOperator = (durationSelector) => subscriber => new ThrottleFirstSubscriber(subscriber, durationSelector);
export const throttleFirst = (durationSelector) => lift(throttleFirstOperator(durationSelector));
export const throttleFirstTime = (duration) => {
const durationSelector = (_) => empty(duration);
return throttleFirst(durationSelector);
};
class ThrottleLastSubscriber extends DelegatingSubscriber {
constructor(delegate, durationSelector) {
super(delegate);
this.durationSubscription = createSerialDisposable();
this.value = undefined;

@@ -42,2 +18,3 @@ this.notifyNext = () => {

const [next] = value;
this.setupDurationSubscription(next);
this.delegate.next(next);

@@ -47,7 +24,11 @@ }

this.durationSelector = durationSelector;
this.mode = mode;
this.add(this.durationSubscription);
}
setupDurationSubscription(next) {
this.durationSubscription.disposable = pipe(this.durationSelector(next), onComplete(this.notifyNext), subscribe(this));
}
onComplete(error) {
this.remove(this.durationSubscription);
if (error === undefined) {
if (error === undefined && this.mode !== 1) {
this.notifyNext();

@@ -58,51 +39,19 @@ }

onNext(data) {
this.value = [data];
if (this.durationSubscription.disposable.isDisposed) {
this.durationSubscription.disposable = pipe(this.durationSelector(data), onComplete(this.notifyNext), connect(this));
if (this.value !== undefined) {
this.value[0] = data;
}
}
}
const throttleLastOperator = (durationSelector) => subscriber => new ThrottleLastSubscriber(subscriber, durationSelector);
export const throttleLast = (durationSelector) => lift(throttleLastOperator(durationSelector));
export const throttleLastTime = (duration) => {
const durationSelector = (_) => empty(duration);
return throttleLast(durationSelector);
};
class ThrottleSubscriber extends DelegatingSubscriber {
constructor(delegate, durationSelector) {
super(delegate);
this.durationSubscription = createSerialDisposable();
this.value = undefined;
this.notifyNext = () => {
const value = this.value;
if (value !== undefined) {
this.value = undefined;
const [next] = value;
this.durationSubscription.disposable = pipe(this.durationSelector(next), onComplete(this.notifyNext), connect(this));
this.delegate.next(next);
}
};
this.durationSelector = durationSelector;
this.add(this.durationSubscription);
}
onComplete(error) {
this.remove(this.durationSubscription);
if (error === undefined) {
this.notifyNext();
else {
this.value = [data];
}
this.delegate.complete(error);
}
onNext(data) {
this.value = [data];
if (this.durationSubscription.disposable.isDisposed) {
if (this.durationSubscription.disposable.isDisposed &&
this.mode !== 2) {
this.notifyNext();
}
else if (this.durationSubscription.disposable.isDisposed) {
this.setupDurationSubscription(data);
}
}
}
const throttleOperator = (durationSelector) => subscriber => new ThrottleSubscriber(subscriber, durationSelector);
export const throttle = (durationSelector) => lift(throttleOperator(durationSelector));
export const throttleTime = (duration) => {
const durationSelector = (_) => empty(duration);
return throttle(durationSelector);
};
const throttleOperator = (durationSelector, mode) => subscriber => new ThrottleSubscriber(subscriber, durationSelector, mode);
export const throttle = (duration, mode = 3) => lift(throttleOperator(typeof duration === "number" ? _ => empty(duration) : duration, mode));
//# sourceMappingURL=throttle.js.map

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

import { ObservableLike } from "@reactive-js/rx";
import { ObservableOperatorLike } from "./interfaces";
export declare const timeout: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const timeout: <T>(duration: number | ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
import { createSerialDisposable, } from "@reactive-js/disposable";
import { connect, DelegatingSubscriber, } from "@reactive-js/rx";
import { subscribe, DelegatingSubscriber, } from "@reactive-js/rx";
import { lift } from "./lift";
import { onError } from "./observe";
import { onComplete } from "./observe";
import { pipe } from "@reactive-js/pipe";

@@ -12,5 +12,2 @@ import { throws } from "./throws";

this.durationSubscription = createSerialDisposable();
this.setupTimeout = () => {
this.durationSubscription.disposable = pipe(throws(timeoutError, this.duration), onError(cause => this.complete({ cause })), connect(this));
};
this.duration = duration;

@@ -24,3 +21,3 @@ this.add(this.durationSubscription);

onNext(data) {
this.setupTimeout();
this.durationSubscription.disposable = pipe(this.duration, onComplete(error => this.complete(error)), subscribe(this));
this.delegate.next(data);

@@ -30,3 +27,3 @@ }

const operator = (duration) => subscriber => new TimeoutSubscriber(subscriber, duration);
export const timeout = (duration) => lift(operator(duration));
export const timeout = (duration) => lift(operator(typeof duration === "number" ? throws(timeoutError, duration) : duration));
//# sourceMappingURL=timeout.js.map

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

import { connect, DelegatingSubscriber, } from "@reactive-js/rx";
import { subscribe, DelegatingSubscriber, } from "@reactive-js/rx";
import { lift } from "./lift";

@@ -9,3 +9,3 @@ import { observe } from "./observe";

this.selector = selector;
this.otherSubscription = pipe(other, observe(new WithLatestFromSubscriber.InnerObserver(this)), connect(this));
this.otherSubscription = pipe(other, observe(new WithLatestFromSubscriber.InnerObserver(this)), subscribe(this));
this.add(this.otherSubscription);

@@ -12,0 +12,0 @@ }

@@ -7,3 +7,3 @@ export { lift } from "./internal/lift";

export { ObservableOperatorLike, SubscriberOperatorLike, } from "./internal/interfaces";
export { iterate, toArray, toIterable, toIterator } from "./internal/iterate";
export { toArray, toIterable } from "./internal/iterate";
export { empty, fromArray, fromScheduledValues, ofValue, } from "./internal/fromArray";

@@ -28,3 +28,3 @@ export { fromIterable } from "./internal/fromIterable";

export { takeWhile } from "./internal/takeWhile";
export { throttleFirst, throttleFirstTime, throttleLast, throttleLastTime, throttle, throttleTime, } from "./internal/throttle";
export { ThrottleMode, throttle } from "./internal/throttle";
export { throws } from "./internal/throws";

@@ -31,0 +31,0 @@ export { timeout } from "./internal/timeout";

import { ObservableLike } from "@reactive-js/rx";
import { VirtualTimeSchedulerResourceLike } from "@reactive-js/schedulers";
import { OperatorLike } from "@reactive-js/pipe";
import { DisposableLike } from "@reactive-js/disposable";
export declare const iterate: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, void>;
export declare const toArray: <T>(schedulerFactory?: (() => VirtualTimeSchedulerResourceLike) | undefined) => OperatorLike<ObservableLike<T>, readonly T[]>;
export interface IteratorResource<T> extends Iterator<T>, DisposableLike {
}
export declare const toIterator: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, IteratorResource<T>>;
export declare const toIterable: <T>(schedulerFactory?: () => VirtualTimeSchedulerResourceLike) => OperatorLike<ObservableLike<T>, Iterable<T>>;
//# sourceMappingURL=iterate.d.ts.map
import { ObservableLike } from "@reactive-js/rx";
import { ObservableOperatorLike } from "./interfaces";
export declare const throttleFirst: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleFirstTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const throttleLast: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleLastTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const throttle: <T>(durationSelector: (next: T) => ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
export declare const throttleTime: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const enum ThrottleMode {
First = 1,
Last = 2,
Interval = 3
}
export declare const throttle: <T>(duration: number | ((next: T) => ObservableLike<unknown>), mode?: ThrottleMode) => ObservableOperatorLike<T, T>;
//# sourceMappingURL=throttle.d.ts.map

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

import { ObservableLike } from "@reactive-js/rx";
import { ObservableOperatorLike } from "./interfaces";
export declare const timeout: <T>(duration: number) => ObservableOperatorLike<T, T>;
export declare const timeout: <T>(duration: number | ObservableLike<unknown>) => ObservableOperatorLike<T, T>;
//# sourceMappingURL=timeout.d.ts.map
{
"name": "@reactive-js/observable",
"version": "0.0.10",
"version": "0.0.11",
"main": "dist/cjs/index.js",

@@ -41,7 +41,7 @@ "module": "dist/esm5/index.js",

"dependencies": {
"@reactive-js/disposable": "^0.0.10",
"@reactive-js/pipe": "^0.0.10",
"@reactive-js/rx": "^0.0.10",
"@reactive-js/scheduler": "^0.0.10",
"@reactive-js/schedulers": "^0.0.10"
"@reactive-js/disposable": "^0.0.11",
"@reactive-js/pipe": "^0.0.11",
"@reactive-js/rx": "^0.0.11",
"@reactive-js/scheduler": "^0.0.11",
"@reactive-js/schedulers": "^0.0.11"
},

@@ -73,3 +73,3 @@ "devDependencies": {

},
"gitHead": "fef42eb9cbce4260e80cf397f7fbd2a3bf3311d5"
"gitHead": "894e4863ea037c317967555ebc27ab66167cfc59"
}

@@ -24,3 +24,3 @@ # @reactive-js/observable

```typescript
import { connect } from "@reactive-js/rx";
import { subscribe } from "@reactive-js/rx";
import {

@@ -43,3 +43,3 @@ exhaust,

onNext(console.log),
connect(scheduler),
subscribe(scheduler),
);

@@ -46,0 +46,0 @@ ```

@@ -6,3 +6,3 @@ import {

SubscriberLike,
connect,
subscribe,
} from "@reactive-js/rx";

@@ -135,3 +135,3 @@ import {

): ObservableLike<any> {
const subscribe = (subscriber: SubscriberLike<any>) => {
const subscribeImpl = (subscriber: SubscriberLike<any>) => {
const ctx: CombineLatestContext = {

@@ -158,3 +158,3 @@ completedCount: 0,

observe(observer),
connect(subscriber),
subscribe(subscriber),
);

@@ -166,3 +166,3 @@

return { subscribe };
return { subscribe: subscribeImpl };
}

@@ -6,3 +6,3 @@ import { disposed } from "@reactive-js/disposable";

SubscriberLike,
connect,
subscribe,
} from "@reactive-js/rx";

@@ -22,3 +22,3 @@ import { fromArray } from "./fromArray";

): ObservableLike<T> {
const subscribe = (subscriber: SubscriberLike<T>) => {
const subscribeImpl = (subscriber: SubscriberLike<T>) => {
const queue = [...observables];

@@ -32,3 +32,7 @@

if (head !== undefined) {
innerSubscription = pipe(head, observe(observer), connect(subscriber));
innerSubscription = pipe(
head,
observe(observer),
subscribe(subscriber),
);

@@ -58,3 +62,3 @@ subscriber.add(innerSubscription);

return { subscribe };
return { subscribe: subscribeImpl };
}

@@ -61,0 +65,0 @@

@@ -15,23 +15,14 @@ import { ObservableLike, SubscriberLike } from "@reactive-js/rx";

const continuation: SchedulerContinuationLike = shouldYield => {
if (subscriber.isDisposed) {
return;
} else if (index < values.length && delay > 0) {
while (index < values.length && !subscriber.isDisposed) {
const value = values[index];
index++;
subscriber.next(value);
return continuationResult;
} else {
while (index < values.length && !subscriber.isDisposed) {
const value = values[index];
index++;
subscriber.next(value);
if (shouldYield()) {
return continuationResult;
}
if (shouldYield() || delay > 0) {
return continuationResult;
}
}
subscriber.complete();
return;
}
subscriber.complete();
return;
};

@@ -38,0 +29,0 @@ const continuationResult: SchedulerContinuationResultLike = {

@@ -21,23 +21,16 @@ import { ObservableLike, SubscriberLike } from "@reactive-js/rx";

const continuation: SchedulerContinuationLike = shouldYield => {
let next = iterator.next();
if (subscriber.isDisposed) {
return;
} else if (next.done) {
subscriber.complete();
return;
} else if (delay > 0) {
for (
let next = iterator.next();
!next.done && !subscriber.isDisposed;
next = iterator.next()
) {
subscriber.next(next.value);
return continuationResult;
} else {
for (; !next.done && !subscriber.isDisposed; next = iterator.next()) {
subscriber.next(next.value);
if (shouldYield()) {
return continuationResult;
}
if (shouldYield() || delay !== 0) {
return continuationResult;
}
}
subscriber.complete();
return;
}
subscriber.complete();
return;
};

@@ -44,0 +37,0 @@ const continuationResult: SchedulerContinuationResultLike = {

@@ -18,5 +18,3 @@ import { ObservableLike, SubscriberLike } from "@reactive-js/rx";

) => {
if (subscriber.isDisposed) {
return;
} else if (delay > 0) {
do {
subscriber.next(acc);

@@ -30,18 +28,5 @@

}
} while (!shouldYield() && !subscriber.isDisposed && delay === 0);
return continuationResult;
} else {
do {
subscriber.next(acc);
try {
acc = generator(acc);
} catch (cause) {
subscriber.complete({ cause });
return;
}
} while (!shouldYield() && !subscriber.isDisposed);
return continuationResult;
}
return continuationResult;
};

@@ -48,0 +33,0 @@ const continuationResult: SchedulerContinuationResultLike = {

import {
connect,
subscribe,
ObservableLike,

@@ -27,3 +27,3 @@ ErrorLike,

}),
connect(scheduler),
subscribe(scheduler),
);

@@ -99,3 +99,3 @@ scheduler.run();

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -102,0 +102,0 @@ scheduler.add(subscription);

@@ -11,3 +11,3 @@ import {

SubscriberLike,
connect,
subscribe,
} from "@reactive-js/rx";

@@ -60,3 +60,3 @@ import { observe } from "./observe";

): ObservableLike<T> {
const subscribe = (subscriber: SubscriberLike<T>) => {
const subscribeImpl = (subscriber: SubscriberLike<T>) => {
const completedCountRef: [number] = [0];

@@ -78,3 +78,3 @@

observe(observer),
connect(subscriber),
subscribe(subscriber),
);

@@ -86,3 +86,3 @@

return { subscribe };
return { subscribe: subscribeImpl };
}
import {
connect,
subscribe,
ErrorLike,

@@ -47,7 +47,7 @@ ObservableLike,

this.queue.push(next);
this.connectNext();
this.subscribeNext();
}
}
private connectNext() {
private subscribeNext() {
if (this.activeCount < this.maxConcurrency) {

@@ -73,7 +73,7 @@ const nextObs = this.queue.shift();

} else {
this.connectNext();
this.subscribeNext();
}
},
}),
connect(this),
subscribe(this),
);

@@ -80,0 +80,0 @@

import {
ObservableLike,
ObserverLike,
connect,
subscribe,
createObservable,

@@ -63,4 +63,4 @@ } from "@reactive-js/rx";

}),
connect(scheduler),
subscribe(scheduler),
);
});

@@ -10,3 +10,3 @@ import {

SubscriberLike,
connect,
subscribe,
DelegatingSubscriber,

@@ -53,3 +53,3 @@ } from "@reactive-js/rx";

observe(this.parent.observer),
connect(this.parent),
subscribe(this.parent),
);

@@ -56,0 +56,0 @@ }

@@ -7,3 +7,3 @@ import { disposed } from "@reactive-js/disposable";

SubscriberLike,
connect,
subscribe,
createSubject,

@@ -55,3 +55,3 @@ } from "@reactive-js/rx";

observe(this.subject),
connect(this.scheduler),
subscribe(this.scheduler),
);

@@ -66,3 +66,3 @@ }

observe(subscriber),
connect(subscriber),
subscribe(subscriber),
);

@@ -69,0 +69,0 @@

import { SchedulerLike } from "@reactive-js/scheduler";
import { pipe } from "@reactive-js/pipe";
import { connect, createObservable } from "@reactive-js/rx";
import { subscribe, createObservable } from "@reactive-js/rx";
import { ObservableOperatorLike } from "./interfaces";

@@ -11,3 +11,3 @@ import { observe } from "./observe";

createObservable(observer =>
pipe(observable, observe(observer), connect(scheduler)),
pipe(observable, observe(observer), subscribe(scheduler)),
);
import { createSerialDisposable, disposed } from "@reactive-js/disposable";
import {
connect,
subscribe,
DelegatingSubscriber,

@@ -48,3 +48,3 @@ ErrorLike,

observe(new SwitchSubscriber.InnerObserver(this)),
connect(this),
subscribe(this),
);

@@ -51,0 +51,0 @@ }

@@ -6,3 +6,3 @@ import {

import {
connect,
subscribe,
DelegatingSubscriber,

@@ -58,3 +58,3 @@ ErrorLike,

onComplete(this.notifyNext),
connect(this),
subscribe(this),
);

@@ -61,0 +61,0 @@ }

@@ -8,3 +8,3 @@ import {

SubscriberLike,
connect,
subscribe,
DelegatingSubscriber,

@@ -41,3 +41,3 @@ ObservableLike,

onComplete(error => this.complete(error)),
connect(this),
subscribe(this),
);

@@ -44,0 +44,0 @@

import { DisposableLike } from "@reactive-js/disposable";
import {
connect,
subscribe,
DelegatingSubscriber,

@@ -54,3 +54,3 @@ ErrorLike,

observe(new WithLatestFromSubscriber.InnerObserver(this)),
connect(this),
subscribe(this),
);

@@ -57,0 +57,0 @@

@@ -7,3 +7,3 @@ import {

import { pipe } from "@reactive-js/pipe";
import { connect, createObservable, ObserverLike } from "@reactive-js/rx";
import { subscribe, createObservable, ObserverLike } from "@reactive-js/rx";
import {

@@ -102,3 +102,3 @@ createVirtualTimeSchedulerResource,

onNext(_ => result.push(3)),
connect(scheduler),
subscribe(scheduler),
);

@@ -284,3 +284,3 @@ scheduler.run();

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -325,3 +325,3 @@ scheduler.run();

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -351,3 +351,3 @@ scheduler.run();

const scheduler = createVirtualTimeSchedulerResource(1);
const subscription = connect(scheduler)(fromIterable(mockIterable));
const subscription = subscribe(scheduler)(fromIterable(mockIterable));
subscription.dispose();

@@ -399,3 +399,3 @@

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -466,3 +466,3 @@ scheduler.run();

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -497,3 +497,3 @@ scheduler.run();

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -516,3 +516,3 @@ scheduler.run();

pipe(src, ignoreElements(), observe(observer), connect(scheduler));
pipe(src, ignoreElements(), observe(observer), subscribe(scheduler));
scheduler.run();

@@ -534,3 +534,3 @@

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -570,3 +570,3 @@ scheduler.run();

observe(observer),
connect(scheduler),
subscribe(scheduler),
);

@@ -606,3 +606,3 @@ scheduler.run();

pipe(empty(), onComplete(cb), observe(observer), connect(scheduler));
pipe(empty(), onComplete(cb), observe(observer), subscribe(scheduler));
scheduler.run();

@@ -621,3 +621,3 @@

pipe(throws(cause), onError(cb), observe(observer), connect(scheduler));
pipe(throws(cause), onError(cb), observe(observer), subscribe(scheduler));
scheduler.run();

@@ -634,3 +634,3 @@

pipe(empty(), onError(cb), observe(observer), connect(scheduler));
pipe(empty(), onError(cb), observe(observer), subscribe(scheduler));
scheduler.run();

@@ -648,3 +648,3 @@

pipe(ofValue(1), onNext(cb), observe(observer), connect(scheduler));
pipe(ofValue(1), onNext(cb), observe(observer), subscribe(scheduler));
scheduler.run();

@@ -803,3 +803,3 @@

pipe(throws(cause), observe(observer), connect(scheduler));
pipe(throws(cause), observe(observer), subscribe(scheduler));
scheduler.run();

@@ -935,3 +935,3 @@

);
const replayedSubscription = connect(scheduler)(replayed);
const replayedSubscription = subscribe(scheduler)(replayed);

@@ -944,3 +944,3 @@ const liftedObserver = createMockObserver();

observe(liftedObserver),
connect(scheduler),
subscribe(scheduler),
);

@@ -958,3 +958,3 @@ }, 1);

observe(anotherLiftedSubscriptionObserver),
connect(scheduler),
subscribe(scheduler),
);

@@ -961,0 +961,0 @@ }, 3);

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

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

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

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

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