Socket
Socket
Sign inDemoInstall

rxjs

Package Overview
Dependencies
1
Maintainers
3
Versions
165
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.0.0-alpha.4 to 8.0.0-alpha.5

29

dist/cjs/internal/observable/dom/animationFrames.js

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

var Observable_1 = require("../../Observable");
var Subscription_1 = require("../../Subscription");
var performanceTimestampProvider_1 = require("../../scheduler/performanceTimestampProvider");

@@ -14,19 +13,25 @@ var animationFrameProvider_1 = require("../../scheduler/animationFrameProvider");

function animationFramesFactory(timestampProvider) {
var schedule = animationFrameProvider_1.animationFrameProvider.schedule;
return new Observable_1.Observable(function (subscriber) {
var subscription = new Subscription_1.Subscription();
var provider = timestampProvider || performanceTimestampProvider_1.performanceTimestampProvider;
var start = provider.now();
var run = function (timestamp) {
var now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
var id = 0;
var run = function () {
if (!subscriber.closed) {
subscription.add(schedule(run));
id = animationFrameProvider_1.animationFrameProvider.requestAnimationFrame(function (timestamp) {
id = 0;
var now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
run();
});
}
};
subscription.add(schedule(run));
return subscription;
run();
return function () {
if (id) {
animationFrameProvider_1.animationFrameProvider.cancelAnimationFrame(id);
}
};
});

@@ -33,0 +38,0 @@ }

@@ -38,7 +38,9 @@ "use strict";

AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
var _a;
if (delay === void 0) { delay = 0; }
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
if (delay != null ? delay > 0 : this.delay > 0) {
return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
}
if (!scheduler.actions.some(function (action) { return action.id === id; })) {
var actions = scheduler.actions;
if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
animationFrameProvider_1.animationFrameProvider.cancelAnimationFrame(id);

@@ -45,0 +47,0 @@ scheduler._scheduled = undefined;

@@ -38,7 +38,9 @@ "use strict";

AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
var _a;
if (delay === void 0) { delay = 0; }
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
if (delay != null ? delay > 0 : this.delay > 0) {
return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
}
if (!scheduler.actions.some(function (action) { return action.id === id; })) {
var actions = scheduler.actions;
if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
immediateProvider_1.immediateProvider.clearImmediate(id);

@@ -45,0 +47,0 @@ scheduler._scheduled = undefined;

@@ -32,2 +32,3 @@ "use strict";

AsyncAction.prototype.schedule = function (state, delay) {
var _a;
if (delay === void 0) { delay = 0; }

@@ -45,3 +46,3 @@ if (this.closed) {

this.delay = delay;
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
return this;

@@ -58,3 +59,5 @@ };

}
intervalProvider_1.intervalProvider.clearInterval(id);
if (id != null) {
intervalProvider_1.intervalProvider.clearInterval(id);
}
return undefined;

@@ -61,0 +64,0 @@ };

@@ -27,3 +27,2 @@ "use strict";

_this._active = false;
_this._scheduled = undefined;
return _this;

@@ -30,0 +29,0 @@ }

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

QueueAction.prototype.execute = function (state, delay) {
return (delay > 0 || this.closed) ?
_super.prototype.execute.call(this, state, delay) :
this._execute(state, delay);
return delay > 0 || this.closed ? _super.prototype.execute.call(this, state, delay) : this._execute(state, delay);
};

@@ -49,3 +47,4 @@ QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {

}
return scheduler.flush(this);
scheduler.flush(this);
return 0;
};

@@ -52,0 +51,0 @@ return QueueAction;

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

actions.sort(VirtualAction.sortActions);
return true;
return 1;
};

@@ -91,0 +91,0 @@ VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {

import { Observable } from '../../Observable';
import { Subscription } from '../../Subscription';
import { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider';

@@ -9,19 +8,25 @@ import { animationFrameProvider } from '../../scheduler/animationFrameProvider';

function animationFramesFactory(timestampProvider) {
const { schedule } = animationFrameProvider;
return new Observable((subscriber) => {
const subscription = new Subscription();
const provider = timestampProvider || performanceTimestampProvider;
const start = provider.now();
const run = (timestamp) => {
const now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
let id = 0;
const run = () => {
if (!subscriber.closed) {
subscription.add(schedule(run));
id = animationFrameProvider.requestAnimationFrame((timestamp) => {
id = 0;
const now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
run();
});
}
};
subscription.add(schedule(run));
return subscription;
run();
return () => {
if (id) {
animationFrameProvider.cancelAnimationFrame(id);
}
};
});

@@ -28,0 +33,0 @@ }

@@ -17,6 +17,8 @@ import { AsyncAction } from './AsyncAction';

recycleAsyncId(scheduler, id, delay = 0) {
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
var _a;
if (delay != null ? delay > 0 : this.delay > 0) {
return super.recycleAsyncId(scheduler, id, delay);
}
if (!scheduler.actions.some((action) => action.id === id)) {
const { actions } = scheduler;
if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
animationFrameProvider.cancelAnimationFrame(id);

@@ -23,0 +25,0 @@ scheduler._scheduled = undefined;

@@ -17,6 +17,8 @@ import { AsyncAction } from './AsyncAction';

recycleAsyncId(scheduler, id, delay = 0) {
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
var _a;
if (delay != null ? delay > 0 : this.delay > 0) {
return super.recycleAsyncId(scheduler, id, delay);
}
if (!scheduler.actions.some((action) => action.id === id)) {
const { actions } = scheduler;
if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
immediateProvider.clearImmediate(id);

@@ -23,0 +25,0 @@ scheduler._scheduled = undefined;

@@ -12,2 +12,3 @@ import { Action } from './Action';

schedule(state, delay = 0) {
var _a;
if (this.closed) {

@@ -24,3 +25,3 @@ return this;

this.delay = delay;
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
return this;

@@ -35,3 +36,5 @@ }

}
intervalProvider.clearInterval(id);
if (id != null) {
intervalProvider.clearInterval(id);
}
return undefined;

@@ -38,0 +41,0 @@ }

@@ -7,3 +7,2 @@ import { Scheduler } from '../Scheduler';

this._active = false;
this._scheduled = undefined;
}

@@ -10,0 +9,0 @@ flush(action) {

@@ -18,5 +18,3 @@ import { AsyncAction } from './AsyncAction';

execute(state, delay) {
return (delay > 0 || this.closed) ?
super.execute(state, delay) :
this._execute(state, delay);
return delay > 0 || this.closed ? super.execute(state, delay) : this._execute(state, delay);
}

@@ -27,5 +25,6 @@ requestAsyncId(scheduler, id, delay = 0) {

}
return scheduler.flush(this);
scheduler.flush(this);
return 0;
}
}
//# sourceMappingURL=QueueAction.js.map

@@ -59,3 +59,3 @@ import { AsyncAction } from './AsyncAction';

actions.sort(VirtualAction.sortActions);
return true;
return 1;
}

@@ -62,0 +62,0 @@ recycleAsyncId(scheduler, id, delay = 0) {

import { Observable } from '../../Observable';
import { Subscription } from '../../Subscription';
import { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider';

@@ -9,19 +8,25 @@ import { animationFrameProvider } from '../../scheduler/animationFrameProvider';

function animationFramesFactory(timestampProvider) {
var schedule = animationFrameProvider.schedule;
return new Observable(function (subscriber) {
var subscription = new Subscription();
var provider = timestampProvider || performanceTimestampProvider;
var start = provider.now();
var run = function (timestamp) {
var now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
var id = 0;
var run = function () {
if (!subscriber.closed) {
subscription.add(schedule(run));
id = animationFrameProvider.requestAnimationFrame(function (timestamp) {
id = 0;
var now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
run();
});
}
};
subscription.add(schedule(run));
return subscription;
run();
return function () {
if (id) {
animationFrameProvider.cancelAnimationFrame(id);
}
};
});

@@ -28,0 +33,0 @@ }

@@ -21,7 +21,9 @@ import { __extends } from "tslib";

AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
var _a;
if (delay === void 0) { delay = 0; }
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
if (delay != null ? delay > 0 : this.delay > 0) {
return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
}
if (!scheduler.actions.some(function (action) { return action.id === id; })) {
var actions = scheduler.actions;
if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
animationFrameProvider.cancelAnimationFrame(id);

@@ -28,0 +30,0 @@ scheduler._scheduled = undefined;

@@ -21,7 +21,9 @@ import { __extends } from "tslib";

AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
var _a;
if (delay === void 0) { delay = 0; }
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
if (delay != null ? delay > 0 : this.delay > 0) {
return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
}
if (!scheduler.actions.some(function (action) { return action.id === id; })) {
var actions = scheduler.actions;
if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {
immediateProvider.clearImmediate(id);

@@ -28,0 +30,0 @@ scheduler._scheduled = undefined;

@@ -15,2 +15,3 @@ import { __extends } from "tslib";

AsyncAction.prototype.schedule = function (state, delay) {
var _a;
if (delay === void 0) { delay = 0; }

@@ -28,3 +29,3 @@ if (this.closed) {

this.delay = delay;
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
return this;

@@ -41,3 +42,5 @@ };

}
intervalProvider.clearInterval(id);
if (id != null) {
intervalProvider.clearInterval(id);
}
return undefined;

@@ -44,0 +47,0 @@ };

@@ -10,3 +10,2 @@ import { __extends } from "tslib";

_this._active = false;
_this._scheduled = undefined;
return _this;

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

@@ -22,5 +22,3 @@ import { __extends } from "tslib";

QueueAction.prototype.execute = function (state, delay) {
return (delay > 0 || this.closed) ?
_super.prototype.execute.call(this, state, delay) :
this._execute(state, delay);
return delay > 0 || this.closed ? _super.prototype.execute.call(this, state, delay) : this._execute(state, delay);
};

@@ -32,3 +30,4 @@ QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {

}
return scheduler.flush(this);
scheduler.flush(this);
return 0;
};

@@ -35,0 +34,0 @@ return QueueAction;

@@ -71,3 +71,3 @@ import { __extends } from "tslib";

actions.sort(VirtualAction.sortActions);
return true;
return 1;
};

@@ -74,0 +74,0 @@ VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {

/**
* Gets what should be in the `response` property of the XHR. However,
* since we still support the final versions of IE, we need to do a little
* checking here to make sure that we get the right thing back. Conquentally,
* checking here to make sure that we get the right thing back. Consequently,
* we need to do a JSON.parse() in here, which *could* throw if the response

@@ -6,0 +6,0 @@ * isn't valid JSON.

@@ -9,3 +9,3 @@ import { Connectable, ObservableInput, SubjectLike } from '../types';

/**
* If true, the resulting observable will reset internal state upon disconnetion
* If true, the resulting observable will reset internal state upon disconnection
* and return to a "cold" state. This allows the resulting observable to be

@@ -12,0 +12,0 @@ * reconnected.

@@ -22,3 +22,3 @@ import { AnonymousSubject } from '../../Subject';

* **deserializer**, the default for this property is `JSON.parse` but since there are just two options
* for incoming data, either be text or binarydata. We can apply a custom deserialization strategy
* for incoming data, either be text or binary data. We can apply a custom deserialization strategy
* or just simply skip the default behaviour.

@@ -25,0 +25,0 @@ *

@@ -32,3 +32,3 @@ import { Observable } from '../Observable';

* which a user can `complete` or `error`, aborting the repetition.
* @return A function that returns an Observable that that mirrors the source
* @return A function that returns an Observable that mirrors the source
* Observable with the exception of a `complete`.

@@ -35,0 +35,0 @@ * @deprecated Will be removed in v9 or v10. Use {@link repeat}'s `delay` option instead.

@@ -24,3 +24,3 @@ import { Subject } from './Subject';

*
* `BehaviorSubject` is similar to `new ReplaySubject(1)`, with a couple fo exceptions:
* `BehaviorSubject` is similar to `new ReplaySubject(1)`, with a couple of exceptions:
*

@@ -27,0 +27,0 @@ * 1. `BehaviorSubject` comes "primed" with a single value upon construction.

import { AsyncAction } from './AsyncAction';
import { AnimationFrameScheduler } from './AnimationFrameScheduler';
import { SchedulerAction } from '../types';
import { TimerHandle } from './timerHandle';
export declare class AnimationFrameAction<T> extends AsyncAction<T> {

@@ -8,5 +9,5 @@ protected scheduler: AnimationFrameScheduler;

constructor(scheduler: AnimationFrameScheduler, work: (this: SchedulerAction<T>, state?: T) => void);
protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay?: number): any;
protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay?: number): any;
protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay?: number): TimerHandle;
protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay?: number): TimerHandle | undefined;
}
//# sourceMappingURL=AnimationFrameAction.d.ts.map
import { AsyncAction } from './AsyncAction';
import { AsapScheduler } from './AsapScheduler';
import { SchedulerAction } from '../types';
import { TimerHandle } from './timerHandle';
export declare class AsapAction<T> extends AsyncAction<T> {

@@ -8,5 +9,5 @@ protected scheduler: AsapScheduler;

constructor(scheduler: AsapScheduler, work: (this: SchedulerAction<T>, state?: T) => void);
protected requestAsyncId(scheduler: AsapScheduler, id?: any, delay?: number): any;
protected recycleAsyncId(scheduler: AsapScheduler, id?: any, delay?: number): any;
protected requestAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay?: number): TimerHandle;
protected recycleAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay?: number): TimerHandle | undefined;
}
//# sourceMappingURL=AsapAction.d.ts.map

@@ -5,6 +5,7 @@ import { Action } from './Action';

import { AsyncScheduler } from './AsyncScheduler';
import { TimerHandle } from './timerHandle';
export declare class AsyncAction<T> extends Action<T> {
protected scheduler: AsyncScheduler;
protected work: (this: SchedulerAction<T>, state?: T) => void;
id: any;
id: TimerHandle | undefined;
state?: T;

@@ -15,4 +16,4 @@ delay: number;

schedule(state?: T, delay?: number): Subscription;
protected requestAsyncId(scheduler: AsyncScheduler, _id?: any, delay?: number): any;
protected recycleAsyncId(_scheduler: AsyncScheduler, id: any, delay?: number | null): any;
protected requestAsyncId(scheduler: AsyncScheduler, _id?: TimerHandle, delay?: number): TimerHandle;
protected recycleAsyncId(_scheduler: AsyncScheduler, id?: TimerHandle, delay?: number | null): TimerHandle | undefined;
/**

@@ -19,0 +20,0 @@ * Immediately executes this action and the `work` it contains.

@@ -5,2 +5,3 @@ import { AsyncAction } from './AsyncAction';

import { SchedulerAction } from '../types';
import { TimerHandle } from './timerHandle';
export declare class QueueAction<T> extends AsyncAction<T> {

@@ -12,4 +13,4 @@ protected scheduler: QueueScheduler;

execute(state: T, delay: number): any;
protected requestAsyncId(scheduler: QueueScheduler, id?: any, delay?: number): any;
protected requestAsyncId(scheduler: QueueScheduler, id?: TimerHandle, delay?: number): TimerHandle;
}
//# sourceMappingURL=QueueAction.d.ts.map

@@ -5,2 +5,3 @@ import { AsyncAction } from './AsyncAction';

import { SchedulerAction } from '../types';
import { TimerHandle } from './timerHandle';
export declare class VirtualTimeScheduler extends AsyncScheduler {

@@ -11,3 +12,3 @@ maxFrames: number;

/**
* The current frame for the state of the virtual scheduler instance. The the difference
* The current frame for the state of the virtual scheduler instance. The difference
* between two "frames" is synonymous with the passage of "virtual time units". So if

@@ -45,4 +46,4 @@ * you record `scheduler.frame` to be `1`, then later, observe `scheduler.frame` to be at `11`,

schedule(state?: T, delay?: number): Subscription;
protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay?: number): any;
protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay?: number): any;
protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay?: number): TimerHandle;
protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay?: number): TimerHandle | undefined;
protected _execute(state: T, delay: number): any;

@@ -49,0 +50,0 @@ private static sortActions;

@@ -39,3 +39,3 @@ import { Operator } from './Operator';

* Creates a new Observable with this Subject as the source. You can do this
* to create customize Observer-side logic of the Subject and conceal it from
* to create custom Observer-side logic of the Subject and conceal it from
* code that uses the Observable.

@@ -42,0 +42,0 @@ * @return {Observable} Observable that the Subject casts to

@@ -85,3 +85,3 @@ import { SubscriptionLike, TeardownLogic } from './types';

*
* If you add the same finalizer instance of a function or an unsubscribable object to a `Subcription` instance
* If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance
* more than once, you will need to call `remove` the same number of times to remove all instances.

@@ -88,0 +88,0 @@ *

@@ -22,3 +22,3 @@ import { Observable } from '../Observable';

* The number of virtual time units each character in a marble diagram represents. If
* the test scheduler is being used in "run mode", via the `run` method, this is temporarly
* the test scheduler is being used in "run mode", via the `run` method, this is temporarily
* set to `1` for the duration of the `run` block, then set back to whatever value it was.

@@ -53,3 +53,3 @@ * @nocollapse

* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
* @param values Values to use for the letters in `marbles`. If omitted, the letters themselves are used.
* @param error The error to use for the `#` marble (if present).

@@ -62,3 +62,3 @@ */

* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
* @param values Values to use for the letters in `marbles`. If omitted, the letters themselves are used.
* @param error The error to use for the `#` marble (if present).

@@ -65,0 +65,0 @@ */

{
"name": "rxjs",
"version": "8.0.0-alpha.4",
"version": "8.0.0-alpha.5",
"description": "Reactive Extensions for modern JavaScript",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

@@ -336,3 +336,3 @@ import { map } from '../operators/map';

} else {
// There is no pre-existing querystring, so we can just use URLSearchParams
// There is no preexisting querystring, so we can just use URLSearchParams
// to convert the passed queryParams into the proper format and encodings.

@@ -339,0 +339,0 @@ // queryParams is converted to any because the runtime is *much* more permissive than

/**
* Gets what should be in the `response` property of the XHR. However,
* since we still support the final versions of IE, we need to do a little
* checking here to make sure that we get the right thing back. Conquentally,
* checking here to make sure that we get the right thing back. Consequently,
* we need to do a JSON.parse() in here, which *could* throw if the response

@@ -6,0 +6,0 @@ * isn't valid JSON.

@@ -63,3 +63,3 @@ /* @prettier */

* will be the context that the output function has at call time. In particular, if `func`
* is called as a method of some objec and if `func` is not already bound, in order to preserve the context
* is called as a method of some object and if `func` is not already bound, in order to preserve the context
* it is recommended that the context of the output function is set to that object as well.

@@ -66,0 +66,0 @@ *

@@ -52,4 +52,4 @@ import { SchedulerLike } from '../types';

// We're going to execute the bound function
// This bit is to signal that we are hitting the callback asychronously.
// Because we don't have any anti-"Zalgo" gaurantees with whatever
// This bit is to signal that we are hitting the callback asynchronously.
// Because we don't have any anti-"Zalgo" guarantees with whatever
// function we are handed, we use this bit to figure out whether or not

@@ -97,3 +97,3 @@ // we are getting hit in a callback synchronously during our call.

// and if that is the case, if we complete here, we are unable to notify
// the consumer than an error occured.
// the consumer than an error occurred.
if (isAsync) {

@@ -117,3 +117,3 @@ subject.complete();

// Return the subscription fron adding our subscriber to the subject.
// Return the subscription from adding our subscriber to the subject.
return subs;

@@ -120,0 +120,0 @@ });

@@ -208,3 +208,3 @@ import { Observable } from '../Observable';

if (observables.length === 0) {
// If no observables are passed, or someone has passed an ampty array
// If no observables are passed, or someone has passed an empty array
// of observables, or even an empty object POJO, we need to just

@@ -211,0 +211,0 @@ // complete (EMPTY), but we have to honor the scheduler provided if any.

@@ -14,3 +14,3 @@ import { Connectable, ObservableInput, SubjectLike } from '../types';

/**
* If true, the resulting observable will reset internal state upon disconnetion
* If true, the resulting observable will reset internal state upon disconnection
* and return to a "cold" state. This allows the resulting observable to be

@@ -17,0 +17,0 @@ * reconnected.

import { Observable } from '../../Observable';
import { Subscription } from '../../Subscription';
import { TimestampProvider } from '../../types';

@@ -85,5 +84,3 @@ import { performanceTimestampProvider } from '../../scheduler/performanceTimestampProvider';

function animationFramesFactory(timestampProvider?: TimestampProvider) {
const { schedule } = animationFrameProvider;
return new Observable<{ timestamp: number; elapsed: number }>((subscriber) => {
const subscription = new Subscription();
// If no timestamp provider is specified, use performance.now() - as it

@@ -93,2 +90,3 @@ // will return timestamps 'compatible' with those passed to the run

const provider = timestampProvider || performanceTimestampProvider;
// Capture the start time upon subscription, as the run callback can remain

@@ -99,21 +97,32 @@ // queued for a considerable period of time and the elapsed time should

const start = provider.now();
const run = (timestamp: DOMHighResTimeStamp | number) => {
// Use the provider's timestamp to calculate the elapsed time. Note that
// this means - if the caller hasn't passed a provider - that
// performance.now() will be used instead of the timestamp that was
// passed to the run callback. The reason for this is that the timestamp
// passed to the callback can be earlier than the start time, as it
// represents the time at which the browser decided it would render any
// queued frames - and that time can be earlier the captured start time.
const now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
let id = 0;
const run = () => {
if (!subscriber.closed) {
subscription.add(schedule(run));
id = animationFrameProvider.requestAnimationFrame((timestamp: DOMHighResTimeStamp | number) => {
id = 0;
// Use the provider's timestamp to calculate the elapsed time. Note that
// this means - if the caller hasn't passed a provider - that
// performance.now() will be used instead of the timestamp that was
// passed to the run callback. The reason for this is that the timestamp
// passed to the callback can be earlier than the start time, as it
// represents the time at which the browser decided it would render any
// queued frames - and that time can be earlier the captured start time.
const now = provider.now();
subscriber.next({
timestamp: timestampProvider ? now : timestamp,
elapsed: now - start,
});
run();
});
}
};
subscription.add(schedule(run));
return subscription;
run();
return () => {
if (id) {
animationFrameProvider.cancelAnimationFrame(id);
}
};
});

@@ -120,0 +129,0 @@ }

@@ -26,3 +26,3 @@ import { Subject, AnonymousSubject } from '../../Subject';

* **deserializer**, the default for this property is `JSON.parse` but since there are just two options
* for incoming data, either be text or binarydata. We can apply a custom deserialization strategy
* for incoming data, either be text or binary data. We can apply a custom deserialization strategy
* or just simply skip the default behaviour.

@@ -29,0 +29,0 @@ *

@@ -49,3 +49,3 @@ import { Observable } from '../Observable';

* // timer will emit ascending values, one every second(1000ms) to console
* // clicks logs MouseEvents to console everytime the "document" is clicked
* // clicks logs MouseEvents to console every time the "document" is clicked
* // Since the two streams are merged you see these happening

@@ -52,0 +52,0 @@ * // as they occur.

@@ -25,11 +25,25 @@ import { Observable } from '../Observable';

*
* `delayWhen` time shifts each emitted value from the source Observable by a
* time span determined by another Observable. When the source emits a value,
* the `delayDurationSelector` function is called with the source value as
* argument, and should return an Observable, called the "duration" Observable.
* The source value is emitted on the output Observable only when the duration
* Observable emits a value or completes.
* The completion of the notifier triggering the emission of the source value
* is deprecated behavior and will be removed in future versions.
* `delayWhen` operator shifts each emitted value from the source Observable by
* a time span determined by another Observable. When the source emits a value,
* the `delayDurationSelector` function is called with the value emitted from
* the source Observable as the first argument to the `delayDurationSelector`.
* The `delayDurationSelector` function should return an Observable, called
* the "duration" Observable.
*
* The source value is emitted on the output Observable only when the "duration"
* Observable emits ({@link guide/glossary-and-semantics#next next}s) any value.
* Upon that, the "duration" Observable gets unsubscribed.
*
* Before RxJS V7, the {@link guide/glossary-and-semantics#complete completion}
* of the "duration" Observable would have been triggering the emission of the
* source value to the output Observable, but with RxJS V7, this is not the case
* anymore.
*
* Only next notifications (from the "duration" Observable) trigger values from
* the source Observable to be passed to the output Observable. If the "duration"
* Observable only emits the complete notification (without next), the value
* emitted by the source Observable will never get to the output Observable - it
* will be swallowed. If the "duration" Observable errors, the error will be
* propagated to the output Observable.
*
* Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which

@@ -36,0 +50,0 @@ * is an Observable. When `subscriptionDelay` emits its first value or

@@ -204,3 +204,3 @@ import { Observable } from '../Observable';

// Providing the group here ensures that it is disposed of -- via `unsubscribe` --
// wnen the duration subscription is torn down. That is important, because then
// when the duration subscription is torn down. That is important, because then
// if someone holds a handle to the grouped observable and tries to subscribe to it

@@ -207,0 +207,0 @@ // after the connection to the source has been severed, they will get an

@@ -38,3 +38,3 @@ import { Observable } from '../Observable';

* which a user can `complete` or `error`, aborting the repetition.
* @return A function that returns an Observable that that mirrors the source
* @return A function that returns an Observable that mirrors the source
* Observable with the exception of a `complete`.

@@ -41,0 +41,0 @@ * @deprecated Will be removed in v9 or v10. Use {@link repeat}'s `delay` option instead.

@@ -135,3 +135,3 @@ import { MonoTypeOperatorFunction, ObservableInput } from '../types';

// After we get the first notification, we
// unsubscribe from the notifer, because we don't want anymore
// unsubscribe from the notifier, because we don't want anymore
// and we resubscribe to the source.

@@ -138,0 +138,0 @@ notifierSubscriber.unsubscribe();

@@ -188,3 +188,3 @@ import { Observable } from '../Observable';

// Create the subject if we don't have one yet. Grab a local reference to
// it as well, which avoids non-null assertations when using it and, if we
// it as well, which avoids non-null assertions when using it and, if we
// connect to it now, then error/complete need a reference after it was

@@ -191,0 +191,0 @@ // reset.

@@ -20,6 +20,7 @@ import { ReplaySubject } from '../ReplaySubject';

* and multicasts through a `ReplaySubject` constructed with the specified arguments.
* A successfully completed source will stay cached in the `shareReplayed observable` forever,
* A successfully completed source will stay cached in the `shareReplay`ed observable forever,
* but an errored source can be retried.
*
* ## Why use shareReplay?
* ## Why use `shareReplay`?
*
* You generally want to use `shareReplay` when you have side-effects or taxing computations

@@ -31,5 +32,4 @@ * that you do not wish to be executed amongst multiple subscribers.

*
* ![](shareReplay.png)
* ## Reference counting
*
* ## Reference counting
* By default `shareReplay` will use `refCount` of false, meaning that it will _not_ unsubscribe the

@@ -148,5 +148,6 @@ * source when the reference counter drops to zero, i.e. the inner `ReplaySubject` will _not_ be unsubscribed

*
* @param {Number} [bufferSize=Infinity] Maximum element count of the replay buffer.
* @param {Number} [windowTime=Infinity] Maximum time length of the replay buffer in milliseconds.
* @param {Scheduler} [scheduler] Scheduler where connected observers within the selector function
* @param configOrBufferSize Maximum element count of the replay buffer or {@link ShareReplayConfig configuration}
* object.
* @param windowTime Maximum time length of the replay buffer in milliseconds.
* @param scheduler Scheduler where connected observers within the selector function
* will be invoked on.

@@ -153,0 +154,0 @@ * @return A function that returns an Observable sequence that contains the

@@ -117,3 +117,3 @@ import { Subscriber } from '../Subscriber';

() => {
// The inner has completed. Null out the inner subcriber to
// The inner has completed. Null out the inner subscriber to
// free up memory and to signal that we have no inner subscription

@@ -120,0 +120,0 @@ // currently.

@@ -333,3 +333,3 @@ import { asyncScheduler } from '../scheduler/async';

// The subscription for our timeout timer. This changes
// every time get get a new value.
// every time we get a new value.
let timerSubscription: Subscription;

@@ -336,0 +336,0 @@ // A bit of state we pass to our with and error factories to

@@ -39,3 +39,3 @@ import { reduce } from './reduce';

// Because arrays are mutable, and we're mutating the array in this
// reducer process, we have to escapulate the creation of the initial
// reducer process, we have to encapsulate the creation of the initial
// array within this `operate` function.

@@ -42,0 +42,0 @@ return operate((source, subscriber) => {

@@ -101,3 +101,3 @@ import { Observable } from '../Observable';

// Subcribe to the source to get things started.
// Subscribe to the source to get things started.
source.subscribe(

@@ -104,0 +104,0 @@ createOperatorSubscriber(

@@ -60,3 +60,3 @@ import { Subscriber } from '../Subscriber';

* When we get an error, we have to notify both the
* destiation subscriber and the window.
* destination subscriber and the window.
*/

@@ -63,0 +63,0 @@ const handleError = (err: any) => {

@@ -28,3 +28,3 @@ import { Subject } from './Subject';

*
* `BehaviorSubject` is similar to `new ReplaySubject(1)`, with a couple fo exceptions:
* `BehaviorSubject` is similar to `new ReplaySubject(1)`, with a couple of exceptions:
*

@@ -31,0 +31,0 @@ * 1. `BehaviorSubject` comes "primed" with a single value upon construction.

@@ -5,2 +5,3 @@ import { AsyncAction } from './AsyncAction';

import { animationFrameProvider } from './animationFrameProvider';
import { TimerHandle } from './timerHandle';

@@ -12,3 +13,3 @@ export class AnimationFrameAction<T> extends AsyncAction<T> {

protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any {
protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
// If delay is greater than 0, request as an async action.

@@ -25,7 +26,8 @@ if (delay !== null && delay > 0) {

}
protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: any, delay: number = 0): any {
protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {
// If delay exists and is greater than 0, or if the delay is null (the
// action wasn't rescheduled) but was originally scheduled as an async
// action, then recycle as an async action.
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
if (delay != null ? delay > 0 : this.delay > 0) {
return super.recycleAsyncId(scheduler, id, delay);

@@ -36,4 +38,5 @@ }

// undefined so the next AnimationFrameAction will request its own.
if (!scheduler.actions.some((action) => action.id === id)) {
animationFrameProvider.cancelAnimationFrame(id);
const { actions } = scheduler;
if (id != null && actions[actions.length - 1]?.id !== id) {
animationFrameProvider.cancelAnimationFrame(id as number);
scheduler._scheduled = undefined;

@@ -40,0 +43,0 @@ }

@@ -5,2 +5,3 @@ import { AsyncAction } from './AsyncAction';

import { immediateProvider } from './immediateProvider';
import { TimerHandle } from './timerHandle';

@@ -12,3 +13,3 @@ export class AsapAction<T> extends AsyncAction<T> {

protected requestAsyncId(scheduler: AsapScheduler, id?: any, delay: number = 0): any {
protected requestAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
// If delay is greater than 0, request as an async action.

@@ -25,7 +26,8 @@ if (delay !== null && delay > 0) {

}
protected recycleAsyncId(scheduler: AsapScheduler, id?: any, delay: number = 0): any {
protected recycleAsyncId(scheduler: AsapScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {
// If delay exists and is greater than 0, or if the delay is null (the
// action wasn't rescheduled) but was originally scheduled as an async
// action, then recycle as an async action.
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
if (delay != null ? delay > 0 : this.delay > 0) {
return super.recycleAsyncId(scheduler, id, delay);

@@ -36,3 +38,4 @@ }

// so the next AsapAction will request its own.
if (!scheduler.actions.some((action) => action.id === id)) {
const { actions } = scheduler;
if (id != null && actions[actions.length - 1]?.id !== id) {
immediateProvider.clearImmediate(id);

@@ -39,0 +42,0 @@ scheduler._scheduled = undefined;

@@ -7,5 +7,6 @@ import { Action } from './Action';

import { arrRemove } from '../util/arrRemove';
import { TimerHandle } from './timerHandle';
export class AsyncAction<T> extends Action<T> {
public id: any;
public id: TimerHandle | undefined;
public state?: T;

@@ -62,3 +63,3 @@ // @ts-ignore: Property has no initializer and is not definitely assigned

// If this action has already an async Id, don't request a new one.
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
this.id = this.id ?? this.requestAsyncId(scheduler, this.id, delay);

@@ -68,7 +69,7 @@ return this;

protected requestAsyncId(scheduler: AsyncScheduler, _id?: any, delay: number = 0): any {
protected requestAsyncId(scheduler: AsyncScheduler, _id?: TimerHandle, delay: number = 0): TimerHandle {
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
}
protected recycleAsyncId(_scheduler: AsyncScheduler, id: any, delay: number | null = 0): any {
protected recycleAsyncId(_scheduler: AsyncScheduler, id?: TimerHandle, delay: number | null = 0): TimerHandle | undefined {
// If this action is rescheduled with the same delay time, don't clear the interval id.

@@ -80,3 +81,6 @@ if (delay != null && this.delay === delay && this.pending === false) {

// or the action has been rescheduled before it's executed, clear the interval id
intervalProvider.clearInterval(id);
if (id != null) {
intervalProvider.clearInterval(id);
}
return undefined;

@@ -83,0 +87,0 @@ }

import { Scheduler } from '../Scheduler';
import { Action } from './Action';
import { AsyncAction } from './AsyncAction';
import { TimerHandle } from './timerHandle';

@@ -21,3 +22,3 @@ export class AsyncScheduler extends Scheduler {

*/
public _scheduled: any = undefined;
public _scheduled: TimerHandle | undefined;

@@ -24,0 +25,0 @@ constructor(SchedulerAction: typeof Action, now: () => number = Scheduler.now) {

@@ -5,7 +5,6 @@ import { AsyncAction } from './AsyncAction';

import { SchedulerAction } from '../types';
import { TimerHandle } from './timerHandle';
export class QueueAction<T> extends AsyncAction<T> {
constructor(protected scheduler: QueueScheduler,
protected work: (this: SchedulerAction<T>, state?: T) => void) {
constructor(protected scheduler: QueueScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {
super(scheduler, work);

@@ -25,8 +24,6 @@ }

public execute(state: T, delay: number): any {
return (delay > 0 || this.closed) ?
super.execute(state, delay) :
this._execute(state, delay) ;
return delay > 0 || this.closed ? super.execute(state, delay) : this._execute(state, delay);
}
protected requestAsyncId(scheduler: QueueScheduler, id?: any, delay: number = 0): any {
protected requestAsyncId(scheduler: QueueScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
// If delay exists and is greater than 0, or if the delay is null (the

@@ -39,5 +36,12 @@ // action wasn't rescheduled) but was originally scheduled as an async

}
// Otherwise flush the scheduler starting with this action.
return scheduler.flush(this);
scheduler.flush(this);
// HACK: In the past, this was returning `void`. However, `void` isn't a valid
// `TimerHandle`, and generally the return value here isn't really used. So the
// compromise is to return `0` which is both "falsy" and a valid `TimerHandle`,
// as opposed to refactoring every other instanceo of `requestAsyncId`.
return 0;
}
}

@@ -5,2 +5,3 @@ import { AsyncAction } from './AsyncAction';

import { SchedulerAction } from '../types';
import { TimerHandle } from './timerHandle';

@@ -12,3 +13,3 @@ export class VirtualTimeScheduler extends AsyncScheduler {

/**
* The current frame for the state of the virtual scheduler instance. The the difference
* The current frame for the state of the virtual scheduler instance. The difference
* between two "frames" is synonymous with the passage of "virtual time units". So if

@@ -97,3 +98,3 @@ * you record `scheduler.frame` to be `1`, then later, observe `scheduler.frame` to be at `11`,

protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): any {
protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle {
this.delay = scheduler.frame + delay;

@@ -103,6 +104,6 @@ const { actions } = scheduler;

(actions as Array<VirtualAction<T>>).sort(VirtualAction.sortActions);
return true;
return 1;
}
protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): any {
protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): TimerHandle | undefined {
return undefined;

@@ -109,0 +110,0 @@ }

@@ -142,3 +142,3 @@ import { Operator } from './Operator';

* Creates a new Observable with this Subject as the source. You can do this
* to create customize Observer-side logic of the Subject and conceal it from
* to create custom Observer-side logic of the Subject and conceal it from
* code that uses the Observable.

@@ -145,0 +145,0 @@ * @return {Observable} Observable that the Subject casts to

@@ -184,3 +184,3 @@ import { isFunction } from './util/isFunction';

*
* If you add the same finalizer instance of a function or an unsubscribable object to a `Subcription` instance
* If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance
* more than once, you will need to call `remove` the same number of times to remove all instances.

@@ -187,0 +187,0 @@ *

@@ -42,3 +42,3 @@ import { Observable } from '../Observable';

* The number of virtual time units each character in a marble diagram represents. If
* the test scheduler is being used in "run mode", via the `run` method, this is temporarly
* the test scheduler is being used in "run mode", via the `run` method, this is temporarily
* set to `1` for the duration of the `run` block, then set back to whatever value it was.

@@ -88,3 +88,3 @@ * @nocollapse

* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
* @param values Values to use for the letters in `marbles`. If omitted, the letters themselves are used.
* @param error The error to use for the `#` marble (if present).

@@ -107,3 +107,3 @@ */

* @param marbles A diagram in the marble DSL. Letters map to keys in `values` if provided.
* @param values Values to use for the letters in `marbles`. If ommitted, the letters themselves are used.
* @param values Values to use for the letters in `marbles`. If omitted, the letters themselves are used.
* @param error The error to use for the `#` marble (if present).

@@ -110,0 +110,0 @@ */

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc