mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-09-14 11:39:05 +00:00
update
This commit is contained in:
18
node_modules/rxjs/observable/ArrayLikeObservable.d.ts
generated
vendored
Normal file
18
node_modules/rxjs/observable/ArrayLikeObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class ArrayLikeObservable<T> extends Observable<T> {
|
||||
private arrayLike;
|
||||
private scheduler;
|
||||
static create<T>(arrayLike: ArrayLike<T>, scheduler?: IScheduler): Observable<T>;
|
||||
static dispatch(state: any): void;
|
||||
private value;
|
||||
constructor(arrayLike: ArrayLike<T>, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
70
node_modules/rxjs/observable/ArrayLikeObservable.js
generated
vendored
Normal file
70
node_modules/rxjs/observable/ArrayLikeObservable.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var ScalarObservable_1 = require('./ScalarObservable');
|
||||
var EmptyObservable_1 = require('./EmptyObservable');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var ArrayLikeObservable = (function (_super) {
|
||||
__extends(ArrayLikeObservable, _super);
|
||||
function ArrayLikeObservable(arrayLike, scheduler) {
|
||||
_super.call(this);
|
||||
this.arrayLike = arrayLike;
|
||||
this.scheduler = scheduler;
|
||||
if (!scheduler && arrayLike.length === 1) {
|
||||
this._isScalar = true;
|
||||
this.value = arrayLike[0];
|
||||
}
|
||||
}
|
||||
ArrayLikeObservable.create = function (arrayLike, scheduler) {
|
||||
var length = arrayLike.length;
|
||||
if (length === 0) {
|
||||
return new EmptyObservable_1.EmptyObservable();
|
||||
}
|
||||
else if (length === 1) {
|
||||
return new ScalarObservable_1.ScalarObservable(arrayLike[0], scheduler);
|
||||
}
|
||||
else {
|
||||
return new ArrayLikeObservable(arrayLike, scheduler);
|
||||
}
|
||||
};
|
||||
ArrayLikeObservable.dispatch = function (state) {
|
||||
var arrayLike = state.arrayLike, index = state.index, length = state.length, subscriber = state.subscriber;
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
if (index >= length) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
subscriber.next(arrayLike[index]);
|
||||
state.index = index + 1;
|
||||
this.schedule(state);
|
||||
};
|
||||
/** @deprecated internal use only */ ArrayLikeObservable.prototype._subscribe = function (subscriber) {
|
||||
var index = 0;
|
||||
var _a = this, arrayLike = _a.arrayLike, scheduler = _a.scheduler;
|
||||
var length = arrayLike.length;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(ArrayLikeObservable.dispatch, 0, {
|
||||
arrayLike: arrayLike, index: index, length: length, subscriber: subscriber
|
||||
});
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < length && !subscriber.closed; i++) {
|
||||
subscriber.next(arrayLike[i]);
|
||||
}
|
||||
subscriber.complete();
|
||||
}
|
||||
};
|
||||
return ArrayLikeObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.ArrayLikeObservable = ArrayLikeObservable;
|
||||
//# sourceMappingURL=ArrayLikeObservable.js.map
|
1
node_modules/rxjs/observable/ArrayLikeObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/ArrayLikeObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ArrayLikeObservable.js","sourceRoot":"","sources":["../../src/observable/ArrayLikeObservable.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAC3C,iCAAiC,oBAAoB,CAAC,CAAA;AACtD,gCAAgC,mBAAmB,CAAC,CAAA;AAIpD;;;;GAIG;AACH;IAA4C,uCAAa;IAmCvD,6BAAoB,SAAuB,EAAU,SAAsB;QACzE,iBAAO,CAAC;QADU,cAAS,GAAT,SAAS,CAAc;QAAU,cAAS,GAAT,SAAS,CAAa;QAEzE,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAvCM,0BAAM,GAAb,UAAiB,SAAuB,EAAE,SAAsB;QAC9D,IAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAChC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,MAAM,CAAC,IAAI,iCAAe,EAAK,CAAC;QAClC,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,MAAM,CAAC,IAAI,mCAAgB,CAAS,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QAC/D,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,CAAC,IAAI,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAEM,4BAAQ,GAAf,UAAgB,KAAU;QAChB,+BAAS,EAAE,mBAAK,EAAE,qBAAM,EAAE,6BAAU,CAAW;QAEvD,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,MAAM,CAAC;QACT,CAAC;QAED,EAAE,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;YACpB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,CAAC;QACT,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAElC,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;QAEjB,IAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAaD,oCAAoC,CAAC,wCAAU,GAAV,UAAW,UAAyB;QACvE,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAA,SAAqC,EAA7B,wBAAS,EAAE,wBAAS,CAAU;QACtC,IAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAEhC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACzD,oBAAS,EAAE,YAAK,EAAE,cAAM,EAAE,sBAAU;aACrC,CAAC,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC;YACD,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AA3DD,CAA4C,uBAAU,GA2DrD;AA3DY,2BAAmB,sBA2D/B,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\nimport { Observable } from '../Observable';\nimport { ScalarObservable } from './ScalarObservable';\nimport { EmptyObservable } from './EmptyObservable';\nimport { Subscriber } from '../Subscriber';\nimport { TeardownLogic } from '../Subscription';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class ArrayLikeObservable<T> extends Observable<T> {\n\n static create<T>(arrayLike: ArrayLike<T>, scheduler?: IScheduler): Observable<T> {\n const length = arrayLike.length;\n if (length === 0) {\n return new EmptyObservable<T>();\n } else if (length === 1) {\n return new ScalarObservable<T>(<any>arrayLike[0], scheduler);\n } else {\n return new ArrayLikeObservable(arrayLike, scheduler);\n }\n }\n\n static dispatch(state: any) {\n const { arrayLike, index, length, subscriber } = state;\n\n if (subscriber.closed) {\n return;\n }\n\n if (index >= length) {\n subscriber.complete();\n return;\n }\n\n subscriber.next(arrayLike[index]);\n\n state.index = index + 1;\n\n (<any> this).schedule(state);\n }\n\n // value used if Array has one value and _isScalar\n private value: any;\n\n constructor(private arrayLike: ArrayLike<T>, private scheduler?: IScheduler) {\n super();\n if (!scheduler && arrayLike.length === 1) {\n this._isScalar = true;\n this.value = arrayLike[0];\n }\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic {\n let index = 0;\n const { arrayLike, scheduler } = this;\n const length = arrayLike.length;\n\n if (scheduler) {\n return scheduler.schedule(ArrayLikeObservable.dispatch, 0, {\n arrayLike, index, length, subscriber\n });\n } else {\n for (let i = 0; i < length && !subscriber.closed; i++) {\n subscriber.next(arrayLike[i]);\n }\n subscriber.complete();\n }\n }\n}\n"]}
|
25
node_modules/rxjs/observable/ArrayObservable.d.ts
generated
vendored
Normal file
25
node_modules/rxjs/observable/ArrayObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class ArrayObservable<T> extends Observable<T> {
|
||||
private array;
|
||||
private scheduler;
|
||||
static create<T>(array: T[], scheduler?: IScheduler): Observable<T>;
|
||||
static of<T>(item1: T, scheduler?: IScheduler): Observable<T>;
|
||||
static of<T>(item1: T, item2: T, scheduler?: IScheduler): Observable<T>;
|
||||
static of<T>(item1: T, item2: T, item3: T, scheduler?: IScheduler): Observable<T>;
|
||||
static of<T>(item1: T, item2: T, item3: T, item4: T, scheduler?: IScheduler): Observable<T>;
|
||||
static of<T>(item1: T, item2: T, item3: T, item4: T, item5: T, scheduler?: IScheduler): Observable<T>;
|
||||
static of<T>(item1: T, item2: T, item3: T, item4: T, item5: T, item6: T, scheduler?: IScheduler): Observable<T>;
|
||||
static of<T>(...array: Array<T | IScheduler>): Observable<T>;
|
||||
static dispatch(state: any): void;
|
||||
value: any;
|
||||
constructor(array: T[], scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
122
node_modules/rxjs/observable/ArrayObservable.js
generated
vendored
Normal file
122
node_modules/rxjs/observable/ArrayObservable.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var ScalarObservable_1 = require('./ScalarObservable');
|
||||
var EmptyObservable_1 = require('./EmptyObservable');
|
||||
var isScheduler_1 = require('../util/isScheduler');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var ArrayObservable = (function (_super) {
|
||||
__extends(ArrayObservable, _super);
|
||||
function ArrayObservable(array, scheduler) {
|
||||
_super.call(this);
|
||||
this.array = array;
|
||||
this.scheduler = scheduler;
|
||||
if (!scheduler && array.length === 1) {
|
||||
this._isScalar = true;
|
||||
this.value = array[0];
|
||||
}
|
||||
}
|
||||
ArrayObservable.create = function (array, scheduler) {
|
||||
return new ArrayObservable(array, scheduler);
|
||||
};
|
||||
/**
|
||||
* Creates an Observable that emits some values you specify as arguments,
|
||||
* immediately one after the other, and then emits a complete notification.
|
||||
*
|
||||
* <span class="informal">Emits the arguments you provide, then completes.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/of.png" width="100%">
|
||||
*
|
||||
* This static operator is useful for creating a simple Observable that only
|
||||
* emits the arguments given, and the complete notification thereafter. It can
|
||||
* be used for composing with other Observables, such as with {@link concat}.
|
||||
* By default, it uses a `null` IScheduler, which means the `next`
|
||||
* notifications are sent synchronously, although with a different IScheduler
|
||||
* it is possible to determine when those notifications will be delivered.
|
||||
*
|
||||
* @example <caption>Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second.</caption>
|
||||
* var numbers = Rx.Observable.of(10, 20, 30);
|
||||
* var letters = Rx.Observable.of('a', 'b', 'c');
|
||||
* var interval = Rx.Observable.interval(1000);
|
||||
* var result = numbers.concat(letters).concat(interval);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link empty}
|
||||
* @see {@link never}
|
||||
* @see {@link throw}
|
||||
*
|
||||
* @param {...T} values Arguments that represent `next` values to be emitted.
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
|
||||
* the emissions of the `next` notifications.
|
||||
* @return {Observable<T>} An Observable that emits each given input value.
|
||||
* @static true
|
||||
* @name of
|
||||
* @owner Observable
|
||||
*/
|
||||
ArrayObservable.of = function () {
|
||||
var array = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
array[_i - 0] = arguments[_i];
|
||||
}
|
||||
var scheduler = array[array.length - 1];
|
||||
if (isScheduler_1.isScheduler(scheduler)) {
|
||||
array.pop();
|
||||
}
|
||||
else {
|
||||
scheduler = null;
|
||||
}
|
||||
var len = array.length;
|
||||
if (len > 1) {
|
||||
return new ArrayObservable(array, scheduler);
|
||||
}
|
||||
else if (len === 1) {
|
||||
return new ScalarObservable_1.ScalarObservable(array[0], scheduler);
|
||||
}
|
||||
else {
|
||||
return new EmptyObservable_1.EmptyObservable(scheduler);
|
||||
}
|
||||
};
|
||||
ArrayObservable.dispatch = function (state) {
|
||||
var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber;
|
||||
if (index >= count) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
subscriber.next(array[index]);
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
state.index = index + 1;
|
||||
this.schedule(state);
|
||||
};
|
||||
/** @deprecated internal use only */ ArrayObservable.prototype._subscribe = function (subscriber) {
|
||||
var index = 0;
|
||||
var array = this.array;
|
||||
var count = array.length;
|
||||
var scheduler = this.scheduler;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(ArrayObservable.dispatch, 0, {
|
||||
array: array, index: index, count: count, subscriber: subscriber
|
||||
});
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < count && !subscriber.closed; i++) {
|
||||
subscriber.next(array[i]);
|
||||
}
|
||||
subscriber.complete();
|
||||
}
|
||||
};
|
||||
return ArrayObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.ArrayObservable = ArrayObservable;
|
||||
//# sourceMappingURL=ArrayObservable.js.map
|
1
node_modules/rxjs/observable/ArrayObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/ArrayObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
42
node_modules/rxjs/observable/BoundCallbackObservable.d.ts
generated
vendored
Normal file
42
node_modules/rxjs/observable/BoundCallbackObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { AsyncSubject } from '../AsyncSubject';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class BoundCallbackObservable<T> extends Observable<T> {
|
||||
private callbackFunc;
|
||||
private selector;
|
||||
private args;
|
||||
private context;
|
||||
private scheduler;
|
||||
subject: AsyncSubject<T>;
|
||||
static create(callbackFunc: (callback: () => any) => any, selector?: void, scheduler?: IScheduler): () => Observable<void>;
|
||||
static create<R>(callbackFunc: (callback: (result: R) => any) => any, selector?: void, scheduler?: IScheduler): () => Observable<R>;
|
||||
static create<T, R>(callbackFunc: (v1: T, callback: (result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T) => Observable<R>;
|
||||
static create<T, T2, R>(callbackFunc: (v1: T, v2: T2, callback: (result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2) => Observable<R>;
|
||||
static create<T, T2, T3, R>(callbackFunc: (v1: T, v2: T2, v3: T3, callback: (result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3) => Observable<R>;
|
||||
static create<T, T2, T3, T4, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, callback: (result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4) => Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, callback: (result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, T6, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, callback: (result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => Observable<R>;
|
||||
static create<R>(callbackFunc: (callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: IScheduler): () => Observable<R>;
|
||||
static create<T, R>(callbackFunc: (v1: T, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: IScheduler): (v1: T) => Observable<R>;
|
||||
static create<T, T2, R>(callbackFunc: (v1: T, v2: T2, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: IScheduler): (v1: T, v2: T2) => Observable<R>;
|
||||
static create<T, T2, T3, R>(callbackFunc: (v1: T, v2: T2, v3: T3, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3) => Observable<R>;
|
||||
static create<T, T2, T3, T4, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4) => Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, T6, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => Observable<R>;
|
||||
static create<T>(callbackFunc: Function, selector?: void, scheduler?: IScheduler): (...args: any[]) => Observable<T>;
|
||||
static create<T>(callbackFunc: Function, selector?: (...args: any[]) => T, scheduler?: IScheduler): (...args: any[]) => Observable<T>;
|
||||
constructor(callbackFunc: Function, selector: Function, args: any[], context: any, scheduler: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T | T[]>): Subscription;
|
||||
static dispatch<T>(state: {
|
||||
source: BoundCallbackObservable<T>;
|
||||
subscriber: Subscriber<T>;
|
||||
context: any;
|
||||
}): void;
|
||||
}
|
264
node_modules/rxjs/observable/BoundCallbackObservable.js
generated
vendored
Normal file
264
node_modules/rxjs/observable/BoundCallbackObservable.js
generated
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var tryCatch_1 = require('../util/tryCatch');
|
||||
var errorObject_1 = require('../util/errorObject');
|
||||
var AsyncSubject_1 = require('../AsyncSubject');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var BoundCallbackObservable = (function (_super) {
|
||||
__extends(BoundCallbackObservable, _super);
|
||||
function BoundCallbackObservable(callbackFunc, selector, args, context, scheduler) {
|
||||
_super.call(this);
|
||||
this.callbackFunc = callbackFunc;
|
||||
this.selector = selector;
|
||||
this.args = args;
|
||||
this.context = context;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Converts a callback API to a function that returns an Observable.
|
||||
*
|
||||
* <span class="informal">Give it a function `f` of type `f(x, callback)` and
|
||||
* it will return a function `g` that when called as `g(x)` will output an
|
||||
* Observable.</span>
|
||||
*
|
||||
* `bindCallback` is not an operator because its input and output are not
|
||||
* Observables. The input is a function `func` with some parameters, the
|
||||
* last parameter must be a callback function that `func` calls when it is
|
||||
* done.
|
||||
*
|
||||
* The output of `bindCallback` is a function that takes the same parameters
|
||||
* as `func`, except the last one (the callback). When the output function
|
||||
* is called with arguments it will return an Observable. If function `func`
|
||||
* calls its callback with one argument the Observable will emit that value.
|
||||
* If on the other hand the callback is called with multiple values the resulting
|
||||
* Observable will emit an array with said values as arguments.
|
||||
*
|
||||
* It is very important to remember that input function `func` is not called
|
||||
* when the output function is, but rather when the Observable returned by the output
|
||||
* function is subscribed. This means if `func` makes an AJAX request, that request
|
||||
* will be made every time someone subscribes to the resulting Observable, but not before.
|
||||
*
|
||||
* Optionally, a selector function can be passed to `bindObservable`. The selector function
|
||||
* takes the same arguments as the callback and returns the value that will be emitted by the Observable.
|
||||
* Even though by default multiple arguments passed to callback appear in the stream as an array
|
||||
* the selector function will be called with arguments directly, just as the callback would.
|
||||
* This means you can imagine the default selector (when one is not provided explicitly)
|
||||
* as a function that aggregates all its arguments into an array, or simply returns first argument
|
||||
* if there is only one.
|
||||
*
|
||||
* The last optional parameter - {@link Scheduler} - can be used to control when the call
|
||||
* to `func` happens after someone subscribes to Observable, as well as when results
|
||||
* passed to callback will be emitted. By default, the subscription to an Observable calls `func`
|
||||
* synchronously, but using `Scheduler.async` as the last parameter will defer the call to `func`,
|
||||
* just like wrapping the call in `setTimeout` with a timeout of `0` would. If you use the async Scheduler
|
||||
* and call `subscribe` on the output Observable all function calls that are currently executing
|
||||
* will end before `func` is invoked.
|
||||
*
|
||||
* By default results passed to the callback are emitted immediately after `func` invokes the callback.
|
||||
* In particular, if the callback is called synchronously the subscription of the resulting Observable
|
||||
* will call the `next` function synchronously as well. If you want to defer that call,
|
||||
* you may use `Scheduler.async` just as before. This means that by using `Scheduler.async` you can
|
||||
* ensure that `func` always calls its callback asynchronously, thus avoiding terrifying Zalgo.
|
||||
*
|
||||
* Note that the Observable created by the output function will always emit a single value
|
||||
* and then complete immediately. If `func` calls the callback multiple times, values from subsequent
|
||||
* calls will not appear in the stream. If you need to listen for multiple calls,
|
||||
* you probably want to use {@link fromEvent} or {@link fromEventPattern} instead.
|
||||
*
|
||||
* If `func` depends on some context (`this` property) and is not already bound the context of `func`
|
||||
* 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
|
||||
* it is recommended that the context of the output function is set to that object as well.
|
||||
*
|
||||
* If the input function calls its callback in the "node style" (i.e. first argument to callback is
|
||||
* optional error parameter signaling whether the call failed or not), {@link bindNodeCallback}
|
||||
* provides convenient error handling and probably is a better choice.
|
||||
* `bindCallback` will treat such functions the same as any other and error parameters
|
||||
* (whether passed or not) will always be interpreted as regular callback argument.
|
||||
*
|
||||
*
|
||||
* @example <caption>Convert jQuery's getJSON to an Observable API</caption>
|
||||
* // Suppose we have jQuery.getJSON('/my/url', callback)
|
||||
* var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON);
|
||||
* var result = getJSONAsObservable('/my/url');
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
*
|
||||
* @example <caption>Receive an array of arguments passed to a callback</caption>
|
||||
* someFunction((a, b, c) => {
|
||||
* console.log(a); // 5
|
||||
* console.log(b); // 'some string'
|
||||
* console.log(c); // {someProperty: 'someValue'}
|
||||
* });
|
||||
*
|
||||
* const boundSomeFunction = Rx.Observable.bindCallback(someFunction);
|
||||
* boundSomeFunction().subscribe(values => {
|
||||
* console.log(values) // [5, 'some string', {someProperty: 'someValue'}]
|
||||
* });
|
||||
*
|
||||
*
|
||||
* @example <caption>Use bindCallback with a selector function</caption>
|
||||
* someFunction((a, b, c) => {
|
||||
* console.log(a); // 'a'
|
||||
* console.log(b); // 'b'
|
||||
* console.log(c); // 'c'
|
||||
* });
|
||||
*
|
||||
* const boundSomeFunction = Rx.Observable.bindCallback(someFunction, (a, b, c) => a + b + c);
|
||||
* boundSomeFunction().subscribe(value => {
|
||||
* console.log(value) // 'abc'
|
||||
* });
|
||||
*
|
||||
*
|
||||
* @example <caption>Compare behaviour with and without async Scheduler</caption>
|
||||
* function iCallMyCallbackSynchronously(cb) {
|
||||
* cb();
|
||||
* }
|
||||
*
|
||||
* const boundSyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously);
|
||||
* const boundAsyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async);
|
||||
*
|
||||
* boundSyncFn().subscribe(() => console.log('I was sync!'));
|
||||
* boundAsyncFn().subscribe(() => console.log('I was async!'));
|
||||
* console.log('This happened...');
|
||||
*
|
||||
* // Logs:
|
||||
* // I was sync!
|
||||
* // This happened...
|
||||
* // I was async!
|
||||
*
|
||||
*
|
||||
* @example <caption>Use bindCallback on an object method</caption>
|
||||
* const boundMethod = Rx.Observable.bindCallback(someObject.methodWithCallback);
|
||||
* boundMethod.call(someObject) // make sure methodWithCallback has access to someObject
|
||||
* .subscribe(subscriber);
|
||||
*
|
||||
*
|
||||
* @see {@link bindNodeCallback}
|
||||
* @see {@link from}
|
||||
* @see {@link fromPromise}
|
||||
*
|
||||
* @param {function} func A function with a callback as the last parameter.
|
||||
* @param {function} [selector] A function which takes the arguments from the
|
||||
* callback and maps them to a value that is emitted on the output Observable.
|
||||
* @param {Scheduler} [scheduler] The scheduler on which to schedule the
|
||||
* callbacks.
|
||||
* @return {function(...params: *): Observable} A function which returns the
|
||||
* Observable that delivers the same values the callback would deliver.
|
||||
* @static true
|
||||
* @name bindCallback
|
||||
* @owner Observable
|
||||
*/
|
||||
BoundCallbackObservable.create = function (func, selector, scheduler) {
|
||||
if (selector === void 0) { selector = undefined; }
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
return new BoundCallbackObservable(func, selector, args, this, scheduler);
|
||||
};
|
||||
};
|
||||
/** @deprecated internal use only */ BoundCallbackObservable.prototype._subscribe = function (subscriber) {
|
||||
var callbackFunc = this.callbackFunc;
|
||||
var args = this.args;
|
||||
var scheduler = this.scheduler;
|
||||
var subject = this.subject;
|
||||
if (!scheduler) {
|
||||
if (!subject) {
|
||||
subject = this.subject = new AsyncSubject_1.AsyncSubject();
|
||||
var handler = function handlerFn() {
|
||||
var innerArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
innerArgs[_i - 0] = arguments[_i];
|
||||
}
|
||||
var source = handlerFn.source;
|
||||
var selector = source.selector, subject = source.subject;
|
||||
if (selector) {
|
||||
var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
|
||||
if (result_1 === errorObject_1.errorObject) {
|
||||
subject.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
subject.next(result_1);
|
||||
subject.complete();
|
||||
}
|
||||
}
|
||||
else {
|
||||
subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
|
||||
subject.complete();
|
||||
}
|
||||
};
|
||||
// use named function instance to avoid closure.
|
||||
handler.source = this;
|
||||
var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler));
|
||||
if (result === errorObject_1.errorObject) {
|
||||
subject.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
}
|
||||
return subject.subscribe(subscriber);
|
||||
}
|
||||
else {
|
||||
return scheduler.schedule(BoundCallbackObservable.dispatch, 0, { source: this, subscriber: subscriber, context: this.context });
|
||||
}
|
||||
};
|
||||
BoundCallbackObservable.dispatch = function (state) {
|
||||
var self = this;
|
||||
var source = state.source, subscriber = state.subscriber, context = state.context;
|
||||
var callbackFunc = source.callbackFunc, args = source.args, scheduler = source.scheduler;
|
||||
var subject = source.subject;
|
||||
if (!subject) {
|
||||
subject = source.subject = new AsyncSubject_1.AsyncSubject();
|
||||
var handler = function handlerFn() {
|
||||
var innerArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
innerArgs[_i - 0] = arguments[_i];
|
||||
}
|
||||
var source = handlerFn.source;
|
||||
var selector = source.selector, subject = source.subject;
|
||||
if (selector) {
|
||||
var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
|
||||
if (result_2 === errorObject_1.errorObject) {
|
||||
self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject }));
|
||||
}
|
||||
else {
|
||||
self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject }));
|
||||
}
|
||||
}
|
||||
else {
|
||||
var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
|
||||
self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));
|
||||
}
|
||||
};
|
||||
// use named function to pass values in without closure
|
||||
handler.source = source;
|
||||
var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler));
|
||||
if (result === errorObject_1.errorObject) {
|
||||
subject.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
}
|
||||
self.add(subject.subscribe(subscriber));
|
||||
};
|
||||
return BoundCallbackObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.BoundCallbackObservable = BoundCallbackObservable;
|
||||
function dispatchNext(arg) {
|
||||
var value = arg.value, subject = arg.subject;
|
||||
subject.next(value);
|
||||
subject.complete();
|
||||
}
|
||||
function dispatchError(arg) {
|
||||
var err = arg.err, subject = arg.subject;
|
||||
subject.error(err);
|
||||
}
|
||||
//# sourceMappingURL=BoundCallbackObservable.js.map
|
1
node_modules/rxjs/observable/BoundCallbackObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/BoundCallbackObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
29
node_modules/rxjs/observable/BoundNodeCallbackObservable.d.ts
generated
vendored
Normal file
29
node_modules/rxjs/observable/BoundNodeCallbackObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { AsyncSubject } from '../AsyncSubject';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class BoundNodeCallbackObservable<T> extends Observable<T> {
|
||||
private callbackFunc;
|
||||
private selector;
|
||||
private args;
|
||||
private context;
|
||||
scheduler: IScheduler;
|
||||
subject: AsyncSubject<T>;
|
||||
static create<R>(callbackFunc: (callback: (err: any, result: R) => any) => any, selector?: void, scheduler?: IScheduler): () => Observable<R>;
|
||||
static create<T, R>(callbackFunc: (v1: T, callback: (err: any, result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T) => Observable<R>;
|
||||
static create<T, T2, R>(callbackFunc: (v1: T, v2: T2, callback: (err: any, result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2) => Observable<R>;
|
||||
static create<T, T2, T3, R>(callbackFunc: (v1: T, v2: T2, v3: T3, callback: (err: any, result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3) => Observable<R>;
|
||||
static create<T, T2, T3, T4, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, callback: (err: any, result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4) => Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, callback: (err: any, result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, T6, R>(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, callback: (err: any, result: R) => any) => any, selector?: void, scheduler?: IScheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => Observable<R>;
|
||||
static create<T>(callbackFunc: Function, selector?: void, scheduler?: IScheduler): (...args: any[]) => Observable<T>;
|
||||
static create<T>(callbackFunc: Function, selector?: (...args: any[]) => T, scheduler?: IScheduler): (...args: any[]) => Observable<T>;
|
||||
constructor(callbackFunc: Function, selector: Function, args: any[], context: any, scheduler: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T | T[]>): Subscription;
|
||||
}
|
263
node_modules/rxjs/observable/BoundNodeCallbackObservable.js
generated
vendored
Normal file
263
node_modules/rxjs/observable/BoundNodeCallbackObservable.js
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var tryCatch_1 = require('../util/tryCatch');
|
||||
var errorObject_1 = require('../util/errorObject');
|
||||
var AsyncSubject_1 = require('../AsyncSubject');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var BoundNodeCallbackObservable = (function (_super) {
|
||||
__extends(BoundNodeCallbackObservable, _super);
|
||||
function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) {
|
||||
_super.call(this);
|
||||
this.callbackFunc = callbackFunc;
|
||||
this.selector = selector;
|
||||
this.args = args;
|
||||
this.context = context;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Converts a Node.js-style callback API to a function that returns an
|
||||
* Observable.
|
||||
*
|
||||
* <span class="informal">It's just like {@link bindCallback}, but the
|
||||
* callback is expected to be of type `callback(error, result)`.</span>
|
||||
*
|
||||
* `bindNodeCallback` is not an operator because its input and output are not
|
||||
* Observables. The input is a function `func` with some parameters, but the
|
||||
* last parameter must be a callback function that `func` calls when it is
|
||||
* done. The callback function is expected to follow Node.js conventions,
|
||||
* where the first argument to the callback is an error object, signaling
|
||||
* whether call was successful. If that object is passed to callback, it means
|
||||
* something went wrong.
|
||||
*
|
||||
* The output of `bindNodeCallback` is a function that takes the same
|
||||
* parameters as `func`, except the last one (the callback). When the output
|
||||
* function is called with arguments, it will return an Observable.
|
||||
* If `func` calls its callback with error parameter present, Observable will
|
||||
* error with that value as well. If error parameter is not passed, Observable will emit
|
||||
* second parameter. If there are more parameters (third and so on),
|
||||
* Observable will emit an array with all arguments, except first error argument.
|
||||
*
|
||||
* Optionally `bindNodeCallback` accepts selector function, which allows you to
|
||||
* make resulting Observable emit value computed by selector, instead of regular
|
||||
* callback arguments. It works similarly to {@link bindCallback} selector, but
|
||||
* Node.js-style error argument will never be passed to that function.
|
||||
*
|
||||
* Note that `func` will not be called at the same time output function is,
|
||||
* but rather whenever resulting Observable is subscribed. By default call to
|
||||
* `func` will happen synchronously after subscription, but that can be changed
|
||||
* with proper {@link Scheduler} provided as optional third parameter. Scheduler
|
||||
* can also control when values from callback will be emitted by Observable.
|
||||
* To find out more, check out documentation for {@link bindCallback}, where
|
||||
* Scheduler works exactly the same.
|
||||
*
|
||||
* As in {@link bindCallback}, context (`this` property) of input function will be set to context
|
||||
* of returned function, when it is called.
|
||||
*
|
||||
* After Observable emits value, it will complete immediately. This means
|
||||
* even if `func` calls callback again, values from second and consecutive
|
||||
* calls will never appear on the stream. If you need to handle functions
|
||||
* that call callbacks multiple times, check out {@link fromEvent} or
|
||||
* {@link fromEventPattern} instead.
|
||||
*
|
||||
* Note that `bindNodeCallback` can be used in non-Node.js environments as well.
|
||||
* "Node.js-style" callbacks are just a convention, so if you write for
|
||||
* browsers or any other environment and API you use implements that callback style,
|
||||
* `bindNodeCallback` can be safely used on that API functions as well.
|
||||
*
|
||||
* Remember that Error object passed to callback does not have to be an instance
|
||||
* of JavaScript built-in `Error` object. In fact, it does not even have to an object.
|
||||
* Error parameter of callback function is interpreted as "present", when value
|
||||
* of that parameter is truthy. It could be, for example, non-zero number, non-empty
|
||||
* string or boolean `true`. In all of these cases resulting Observable would error
|
||||
* with that value. This means usually regular style callbacks will fail very often when
|
||||
* `bindNodeCallback` is used. If your Observable errors much more often then you
|
||||
* would expect, check if callback really is called in Node.js-style and, if not,
|
||||
* switch to {@link bindCallback} instead.
|
||||
*
|
||||
* Note that even if error parameter is technically present in callback, but its value
|
||||
* is falsy, it still won't appear in array emitted by Observable or in selector function.
|
||||
*
|
||||
*
|
||||
* @example <caption>Read a file from the filesystem and get the data as an Observable</caption>
|
||||
* import * as fs from 'fs';
|
||||
* var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile);
|
||||
* var result = readFileAsObservable('./roadNames.txt', 'utf8');
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
*
|
||||
* @example <caption>Use on function calling callback with multiple arguments</caption>
|
||||
* someFunction((err, a, b) => {
|
||||
* console.log(err); // null
|
||||
* console.log(a); // 5
|
||||
* console.log(b); // "some string"
|
||||
* });
|
||||
* var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction);
|
||||
* boundSomeFunction()
|
||||
* .subscribe(value => {
|
||||
* console.log(value); // [5, "some string"]
|
||||
* });
|
||||
*
|
||||
*
|
||||
* @example <caption>Use with selector function</caption>
|
||||
* someFunction((err, a, b) => {
|
||||
* console.log(err); // undefined
|
||||
* console.log(a); // "abc"
|
||||
* console.log(b); // "DEF"
|
||||
* });
|
||||
* var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b);
|
||||
* boundSomeFunction()
|
||||
* .subscribe(value => {
|
||||
* console.log(value); // "abcDEF"
|
||||
* });
|
||||
*
|
||||
*
|
||||
* @example <caption>Use on function calling callback in regular style</caption>
|
||||
* someFunction(a => {
|
||||
* console.log(a); // 5
|
||||
* });
|
||||
* var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction);
|
||||
* boundSomeFunction()
|
||||
* .subscribe(
|
||||
* value => {} // never gets called
|
||||
* err => console.log(err) // 5
|
||||
*);
|
||||
*
|
||||
*
|
||||
* @see {@link bindCallback}
|
||||
* @see {@link from}
|
||||
* @see {@link fromPromise}
|
||||
*
|
||||
* @param {function} func Function with a Node.js-style callback as the last parameter.
|
||||
* @param {function} [selector] A function which takes the arguments from the
|
||||
* callback and maps those to a value to emit on the output Observable.
|
||||
* @param {Scheduler} [scheduler] The scheduler on which to schedule the
|
||||
* callbacks.
|
||||
* @return {function(...params: *): Observable} A function which returns the
|
||||
* Observable that delivers the same values the Node.js callback would
|
||||
* deliver.
|
||||
* @static true
|
||||
* @name bindNodeCallback
|
||||
* @owner Observable
|
||||
*/
|
||||
BoundNodeCallbackObservable.create = function (func, selector, scheduler) {
|
||||
if (selector === void 0) { selector = undefined; }
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
return new BoundNodeCallbackObservable(func, selector, args, this, scheduler);
|
||||
};
|
||||
};
|
||||
/** @deprecated internal use only */ BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) {
|
||||
var callbackFunc = this.callbackFunc;
|
||||
var args = this.args;
|
||||
var scheduler = this.scheduler;
|
||||
var subject = this.subject;
|
||||
if (!scheduler) {
|
||||
if (!subject) {
|
||||
subject = this.subject = new AsyncSubject_1.AsyncSubject();
|
||||
var handler = function handlerFn() {
|
||||
var innerArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
innerArgs[_i - 0] = arguments[_i];
|
||||
}
|
||||
var source = handlerFn.source;
|
||||
var selector = source.selector, subject = source.subject;
|
||||
var err = innerArgs.shift();
|
||||
if (err) {
|
||||
subject.error(err);
|
||||
}
|
||||
else if (selector) {
|
||||
var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
|
||||
if (result_1 === errorObject_1.errorObject) {
|
||||
subject.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
subject.next(result_1);
|
||||
subject.complete();
|
||||
}
|
||||
}
|
||||
else {
|
||||
subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
|
||||
subject.complete();
|
||||
}
|
||||
};
|
||||
// use named function instance to avoid closure.
|
||||
handler.source = this;
|
||||
var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler));
|
||||
if (result === errorObject_1.errorObject) {
|
||||
subject.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
}
|
||||
return subject.subscribe(subscriber);
|
||||
}
|
||||
else {
|
||||
return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context });
|
||||
}
|
||||
};
|
||||
return BoundNodeCallbackObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable;
|
||||
function dispatch(state) {
|
||||
var self = this;
|
||||
var source = state.source, subscriber = state.subscriber, context = state.context;
|
||||
// XXX: cast to `any` to access to the private field in `source`.
|
||||
var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler;
|
||||
var subject = source.subject;
|
||||
if (!subject) {
|
||||
subject = source.subject = new AsyncSubject_1.AsyncSubject();
|
||||
var handler = function handlerFn() {
|
||||
var innerArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
innerArgs[_i - 0] = arguments[_i];
|
||||
}
|
||||
var source = handlerFn.source;
|
||||
var selector = source.selector, subject = source.subject;
|
||||
var err = innerArgs.shift();
|
||||
if (err) {
|
||||
self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));
|
||||
}
|
||||
else if (selector) {
|
||||
var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs);
|
||||
if (result_2 === errorObject_1.errorObject) {
|
||||
self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject }));
|
||||
}
|
||||
else {
|
||||
self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject }));
|
||||
}
|
||||
}
|
||||
else {
|
||||
var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
|
||||
self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));
|
||||
}
|
||||
};
|
||||
// use named function to pass values in without closure
|
||||
handler.source = source;
|
||||
var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler));
|
||||
if (result === errorObject_1.errorObject) {
|
||||
self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject }));
|
||||
}
|
||||
}
|
||||
self.add(subject.subscribe(subscriber));
|
||||
}
|
||||
function dispatchNext(arg) {
|
||||
var value = arg.value, subject = arg.subject;
|
||||
subject.next(value);
|
||||
subject.complete();
|
||||
}
|
||||
function dispatchError(arg) {
|
||||
var err = arg.err, subject = arg.subject;
|
||||
subject.error(err);
|
||||
}
|
||||
//# sourceMappingURL=BoundNodeCallbackObservable.js.map
|
1
node_modules/rxjs/observable/BoundNodeCallbackObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/BoundNodeCallbackObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/rxjs/observable/ConnectableObservable.d.ts
generated
vendored
Normal file
22
node_modules/rxjs/observable/ConnectableObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Subject } from '../Subject';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
/**
|
||||
* @class ConnectableObservable<T>
|
||||
*/
|
||||
export declare class ConnectableObservable<T> extends Observable<T> {
|
||||
/** @deprecated internal use only */ source: Observable<T>;
|
||||
/** @deprecated internal use only */ subjectFactory: () => Subject<T>;
|
||||
/** @deprecated internal use only */ _subject: Subject<T>;
|
||||
/** @deprecated internal use only */ _refCount: number;
|
||||
/** @deprecated internal use only */ _connection: Subscription;
|
||||
_isComplete: boolean;
|
||||
constructor(/** @deprecated internal use only */ source: Observable<T>,
|
||||
/** @deprecated internal use only */ subjectFactory: () => Subject<T>);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): Subscription;
|
||||
/** @deprecated internal use only */ getSubject(): Subject<T>;
|
||||
connect(): Subscription;
|
||||
refCount(): Observable<T>;
|
||||
}
|
||||
export declare const connectableObservableDescriptor: PropertyDescriptorMap;
|
171
node_modules/rxjs/observable/ConnectableObservable.js
generated
vendored
Normal file
171
node_modules/rxjs/observable/ConnectableObservable.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subject_1 = require('../Subject');
|
||||
var Observable_1 = require('../Observable');
|
||||
var Subscriber_1 = require('../Subscriber');
|
||||
var Subscription_1 = require('../Subscription');
|
||||
var refCount_1 = require('../operators/refCount');
|
||||
/**
|
||||
* @class ConnectableObservable<T>
|
||||
*/
|
||||
var ConnectableObservable = (function (_super) {
|
||||
__extends(ConnectableObservable, _super);
|
||||
function ConnectableObservable(/** @deprecated internal use only */ source,
|
||||
/** @deprecated internal use only */ subjectFactory) {
|
||||
_super.call(this);
|
||||
this.source = source;
|
||||
this.subjectFactory = subjectFactory;
|
||||
/** @deprecated internal use only */ this._refCount = 0;
|
||||
this._isComplete = false;
|
||||
}
|
||||
/** @deprecated internal use only */ ConnectableObservable.prototype._subscribe = function (subscriber) {
|
||||
return this.getSubject().subscribe(subscriber);
|
||||
};
|
||||
/** @deprecated internal use only */ ConnectableObservable.prototype.getSubject = function () {
|
||||
var subject = this._subject;
|
||||
if (!subject || subject.isStopped) {
|
||||
this._subject = this.subjectFactory();
|
||||
}
|
||||
return this._subject;
|
||||
};
|
||||
ConnectableObservable.prototype.connect = function () {
|
||||
var connection = this._connection;
|
||||
if (!connection) {
|
||||
this._isComplete = false;
|
||||
connection = this._connection = new Subscription_1.Subscription();
|
||||
connection.add(this.source
|
||||
.subscribe(new ConnectableSubscriber(this.getSubject(), this)));
|
||||
if (connection.closed) {
|
||||
this._connection = null;
|
||||
connection = Subscription_1.Subscription.EMPTY;
|
||||
}
|
||||
else {
|
||||
this._connection = connection;
|
||||
}
|
||||
}
|
||||
return connection;
|
||||
};
|
||||
ConnectableObservable.prototype.refCount = function () {
|
||||
return refCount_1.refCount()(this);
|
||||
};
|
||||
return ConnectableObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.ConnectableObservable = ConnectableObservable;
|
||||
var connectableProto = ConnectableObservable.prototype;
|
||||
exports.connectableObservableDescriptor = {
|
||||
operator: { value: null },
|
||||
_refCount: { value: 0, writable: true },
|
||||
_subject: { value: null, writable: true },
|
||||
_connection: { value: null, writable: true },
|
||||
_subscribe: { value: connectableProto._subscribe },
|
||||
_isComplete: { value: connectableProto._isComplete, writable: true },
|
||||
getSubject: { value: connectableProto.getSubject },
|
||||
connect: { value: connectableProto.connect },
|
||||
refCount: { value: connectableProto.refCount }
|
||||
};
|
||||
var ConnectableSubscriber = (function (_super) {
|
||||
__extends(ConnectableSubscriber, _super);
|
||||
function ConnectableSubscriber(destination, connectable) {
|
||||
_super.call(this, destination);
|
||||
this.connectable = connectable;
|
||||
}
|
||||
ConnectableSubscriber.prototype._error = function (err) {
|
||||
this._unsubscribe();
|
||||
_super.prototype._error.call(this, err);
|
||||
};
|
||||
ConnectableSubscriber.prototype._complete = function () {
|
||||
this.connectable._isComplete = true;
|
||||
this._unsubscribe();
|
||||
_super.prototype._complete.call(this);
|
||||
};
|
||||
/** @deprecated internal use only */ ConnectableSubscriber.prototype._unsubscribe = function () {
|
||||
var connectable = this.connectable;
|
||||
if (connectable) {
|
||||
this.connectable = null;
|
||||
var connection = connectable._connection;
|
||||
connectable._refCount = 0;
|
||||
connectable._subject = null;
|
||||
connectable._connection = null;
|
||||
if (connection) {
|
||||
connection.unsubscribe();
|
||||
}
|
||||
}
|
||||
};
|
||||
return ConnectableSubscriber;
|
||||
}(Subject_1.SubjectSubscriber));
|
||||
var RefCountOperator = (function () {
|
||||
function RefCountOperator(connectable) {
|
||||
this.connectable = connectable;
|
||||
}
|
||||
RefCountOperator.prototype.call = function (subscriber, source) {
|
||||
var connectable = this.connectable;
|
||||
connectable._refCount++;
|
||||
var refCounter = new RefCountSubscriber(subscriber, connectable);
|
||||
var subscription = source.subscribe(refCounter);
|
||||
if (!refCounter.closed) {
|
||||
refCounter.connection = connectable.connect();
|
||||
}
|
||||
return subscription;
|
||||
};
|
||||
return RefCountOperator;
|
||||
}());
|
||||
var RefCountSubscriber = (function (_super) {
|
||||
__extends(RefCountSubscriber, _super);
|
||||
function RefCountSubscriber(destination, connectable) {
|
||||
_super.call(this, destination);
|
||||
this.connectable = connectable;
|
||||
}
|
||||
/** @deprecated internal use only */ RefCountSubscriber.prototype._unsubscribe = function () {
|
||||
var connectable = this.connectable;
|
||||
if (!connectable) {
|
||||
this.connection = null;
|
||||
return;
|
||||
}
|
||||
this.connectable = null;
|
||||
var refCount = connectable._refCount;
|
||||
if (refCount <= 0) {
|
||||
this.connection = null;
|
||||
return;
|
||||
}
|
||||
connectable._refCount = refCount - 1;
|
||||
if (refCount > 1) {
|
||||
this.connection = null;
|
||||
return;
|
||||
}
|
||||
///
|
||||
// Compare the local RefCountSubscriber's connection Subscription to the
|
||||
// connection Subscription on the shared ConnectableObservable. In cases
|
||||
// where the ConnectableObservable source synchronously emits values, and
|
||||
// the RefCountSubscriber's downstream Observers synchronously unsubscribe,
|
||||
// execution continues to here before the RefCountOperator has a chance to
|
||||
// supply the RefCountSubscriber with the shared connection Subscription.
|
||||
// For example:
|
||||
// ```
|
||||
// Observable.range(0, 10)
|
||||
// .publish()
|
||||
// .refCount()
|
||||
// .take(5)
|
||||
// .subscribe();
|
||||
// ```
|
||||
// In order to account for this case, RefCountSubscriber should only dispose
|
||||
// the ConnectableObservable's shared connection Subscription if the
|
||||
// connection Subscription exists, *and* either:
|
||||
// a. RefCountSubscriber doesn't have a reference to the shared connection
|
||||
// Subscription yet, or,
|
||||
// b. RefCountSubscriber's connection Subscription reference is identical
|
||||
// to the shared connection Subscription
|
||||
///
|
||||
var connection = this.connection;
|
||||
var sharedConnection = connectable._connection;
|
||||
this.connection = null;
|
||||
if (sharedConnection && (!connection || sharedConnection === connection)) {
|
||||
sharedConnection.unsubscribe();
|
||||
}
|
||||
};
|
||||
return RefCountSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
//# sourceMappingURL=ConnectableObservable.js.map
|
1
node_modules/rxjs/observable/ConnectableObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/ConnectableObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
60
node_modules/rxjs/observable/DeferObservable.d.ts
generated
vendored
Normal file
60
node_modules/rxjs/observable/DeferObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { Observable, SubscribableOrPromise } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class DeferObservable<T> extends Observable<T> {
|
||||
private observableFactory;
|
||||
/**
|
||||
* Creates an Observable that, on subscribe, calls an Observable factory to
|
||||
* make an Observable for each new Observer.
|
||||
*
|
||||
* <span class="informal">Creates the Observable lazily, that is, only when it
|
||||
* is subscribed.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/defer.png" width="100%">
|
||||
*
|
||||
* `defer` allows you to create the Observable only when the Observer
|
||||
* subscribes, and create a fresh Observable for each Observer. It waits until
|
||||
* an Observer subscribes to it, and then it generates an Observable,
|
||||
* typically with an Observable factory function. It does this afresh for each
|
||||
* subscriber, so although each subscriber may think it is subscribing to the
|
||||
* same Observable, in fact each subscriber gets its own individual
|
||||
* Observable.
|
||||
*
|
||||
* @example <caption>Subscribe to either an Observable of clicks or an Observable of interval, at random</caption>
|
||||
* var clicksOrInterval = Rx.Observable.defer(function () {
|
||||
* if (Math.random() > 0.5) {
|
||||
* return Rx.Observable.fromEvent(document, 'click');
|
||||
* } else {
|
||||
* return Rx.Observable.interval(1000);
|
||||
* }
|
||||
* });
|
||||
* clicksOrInterval.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following behavior:
|
||||
* // If the result of Math.random() is greater than 0.5 it will listen
|
||||
* // for clicks anywhere on the "document"; when document is clicked it
|
||||
* // will log a MouseEvent object to the console. If the result is less
|
||||
* // than 0.5 it will emit ascending numbers, one every second(1000ms).
|
||||
*
|
||||
* @see {@link create}
|
||||
*
|
||||
* @param {function(): SubscribableOrPromise} observableFactory The Observable
|
||||
* factory function to invoke for each Observer that subscribes to the output
|
||||
* Observable. May also return a Promise, which will be converted on the fly
|
||||
* to an Observable.
|
||||
* @return {Observable} An Observable whose Observers' subscriptions trigger
|
||||
* an invocation of the given Observable factory function.
|
||||
* @static true
|
||||
* @name defer
|
||||
* @owner Observable
|
||||
*/
|
||||
static create<T>(observableFactory: () => SubscribableOrPromise<T> | void): Observable<T>;
|
||||
constructor(observableFactory: () => SubscribableOrPromise<T> | void);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): Subscription;
|
||||
}
|
99
node_modules/rxjs/observable/DeferObservable.js
generated
vendored
Normal file
99
node_modules/rxjs/observable/DeferObservable.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var DeferObservable = (function (_super) {
|
||||
__extends(DeferObservable, _super);
|
||||
function DeferObservable(observableFactory) {
|
||||
_super.call(this);
|
||||
this.observableFactory = observableFactory;
|
||||
}
|
||||
/**
|
||||
* Creates an Observable that, on subscribe, calls an Observable factory to
|
||||
* make an Observable for each new Observer.
|
||||
*
|
||||
* <span class="informal">Creates the Observable lazily, that is, only when it
|
||||
* is subscribed.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/defer.png" width="100%">
|
||||
*
|
||||
* `defer` allows you to create the Observable only when the Observer
|
||||
* subscribes, and create a fresh Observable for each Observer. It waits until
|
||||
* an Observer subscribes to it, and then it generates an Observable,
|
||||
* typically with an Observable factory function. It does this afresh for each
|
||||
* subscriber, so although each subscriber may think it is subscribing to the
|
||||
* same Observable, in fact each subscriber gets its own individual
|
||||
* Observable.
|
||||
*
|
||||
* @example <caption>Subscribe to either an Observable of clicks or an Observable of interval, at random</caption>
|
||||
* var clicksOrInterval = Rx.Observable.defer(function () {
|
||||
* if (Math.random() > 0.5) {
|
||||
* return Rx.Observable.fromEvent(document, 'click');
|
||||
* } else {
|
||||
* return Rx.Observable.interval(1000);
|
||||
* }
|
||||
* });
|
||||
* clicksOrInterval.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following behavior:
|
||||
* // If the result of Math.random() is greater than 0.5 it will listen
|
||||
* // for clicks anywhere on the "document"; when document is clicked it
|
||||
* // will log a MouseEvent object to the console. If the result is less
|
||||
* // than 0.5 it will emit ascending numbers, one every second(1000ms).
|
||||
*
|
||||
* @see {@link create}
|
||||
*
|
||||
* @param {function(): SubscribableOrPromise} observableFactory The Observable
|
||||
* factory function to invoke for each Observer that subscribes to the output
|
||||
* Observable. May also return a Promise, which will be converted on the fly
|
||||
* to an Observable.
|
||||
* @return {Observable} An Observable whose Observers' subscriptions trigger
|
||||
* an invocation of the given Observable factory function.
|
||||
* @static true
|
||||
* @name defer
|
||||
* @owner Observable
|
||||
*/
|
||||
DeferObservable.create = function (observableFactory) {
|
||||
return new DeferObservable(observableFactory);
|
||||
};
|
||||
/** @deprecated internal use only */ DeferObservable.prototype._subscribe = function (subscriber) {
|
||||
return new DeferSubscriber(subscriber, this.observableFactory);
|
||||
};
|
||||
return DeferObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.DeferObservable = DeferObservable;
|
||||
var DeferSubscriber = (function (_super) {
|
||||
__extends(DeferSubscriber, _super);
|
||||
function DeferSubscriber(destination, factory) {
|
||||
_super.call(this, destination);
|
||||
this.factory = factory;
|
||||
this.tryDefer();
|
||||
}
|
||||
DeferSubscriber.prototype.tryDefer = function () {
|
||||
try {
|
||||
this._callFactory();
|
||||
}
|
||||
catch (err) {
|
||||
this._error(err);
|
||||
}
|
||||
};
|
||||
DeferSubscriber.prototype._callFactory = function () {
|
||||
var result = this.factory();
|
||||
if (result) {
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, result));
|
||||
}
|
||||
};
|
||||
return DeferSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=DeferObservable.js.map
|
1
node_modules/rxjs/observable/DeferObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/DeferObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DeferObservable.js","sourceRoot":"","sources":["../../src/observable/DeferObservable.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAkD,eAAe,CAAC,CAAA;AAIlE,kCAAkC,2BAA2B,CAAC,CAAA;AAC9D,gCAAgC,oBAAoB,CAAC,CAAA;AACrD;;;;GAIG;AACH;IAAwC,mCAAa;IAoDnD,yBAAoB,iBAAwD;QAC1E,iBAAO,CAAC;QADU,sBAAiB,GAAjB,iBAAiB,CAAuC;IAE5E,CAAC;IApDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACI,sBAAM,GAAb,UAAiB,iBAAwD;QACvE,MAAM,CAAC,IAAI,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAChD,CAAC;IAMD,oCAAoC,CAAC,oCAAU,GAAV,UAAW,UAAyB;QACvE,MAAM,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACjE,CAAC;IACH,sBAAC;AAAD,CAAC,AA3DD,CAAwC,uBAAU,GA2DjD;AA3DY,uBAAe,kBA2D3B,CAAA;AAED;IAAiC,mCAAqB;IACpD,yBAAY,WAA0B,EAClB,OAA8C;QAChE,kBAAM,WAAW,CAAC,CAAC;QADD,YAAO,GAAP,OAAO,CAAuC;QAEhE,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAEO,kCAAQ,GAAhB;QACE,IAAI,CAAC;YACH,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAE;QAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAEO,sCAAY,GAApB;QACE,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC9B,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACX,IAAI,CAAC,GAAG,CAAC,qCAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AArBD,CAAiC,iCAAe,GAqB/C","sourcesContent":["import { Observable, SubscribableOrPromise } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\n\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class DeferObservable<T> extends Observable<T> {\n\n /**\n * Creates an Observable that, on subscribe, calls an Observable factory to\n * make an Observable for each new Observer.\n *\n * <span class=\"informal\">Creates the Observable lazily, that is, only when it\n * is subscribed.\n * </span>\n *\n * <img src=\"./img/defer.png\" width=\"100%\">\n *\n * `defer` allows you to create the Observable only when the Observer\n * subscribes, and create a fresh Observable for each Observer. It waits until\n * an Observer subscribes to it, and then it generates an Observable,\n * typically with an Observable factory function. It does this afresh for each\n * subscriber, so although each subscriber may think it is subscribing to the\n * same Observable, in fact each subscriber gets its own individual\n * Observable.\n *\n * @example <caption>Subscribe to either an Observable of clicks or an Observable of interval, at random</caption>\n * var clicksOrInterval = Rx.Observable.defer(function () {\n * if (Math.random() > 0.5) {\n * return Rx.Observable.fromEvent(document, 'click');\n * } else {\n * return Rx.Observable.interval(1000);\n * }\n * });\n * clicksOrInterval.subscribe(x => console.log(x));\n *\n * // Results in the following behavior:\n * // If the result of Math.random() is greater than 0.5 it will listen\n * // for clicks anywhere on the \"document\"; when document is clicked it\n * // will log a MouseEvent object to the console. If the result is less\n * // than 0.5 it will emit ascending numbers, one every second(1000ms).\n *\n * @see {@link create}\n *\n * @param {function(): SubscribableOrPromise} observableFactory The Observable\n * factory function to invoke for each Observer that subscribes to the output\n * Observable. May also return a Promise, which will be converted on the fly\n * to an Observable.\n * @return {Observable} An Observable whose Observers' subscriptions trigger\n * an invocation of the given Observable factory function.\n * @static true\n * @name defer\n * @owner Observable\n */\n static create<T>(observableFactory: () => SubscribableOrPromise<T> | void): Observable<T> {\n return new DeferObservable(observableFactory);\n }\n\n constructor(private observableFactory: () => SubscribableOrPromise<T> | void) {\n super();\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): Subscription {\n return new DeferSubscriber(subscriber, this.observableFactory);\n }\n}\n\nclass DeferSubscriber<T> extends OuterSubscriber<T, T> {\n constructor(destination: Subscriber<T>,\n private factory: () => SubscribableOrPromise<T> | void) {\n super(destination);\n this.tryDefer();\n }\n\n private tryDefer(): void {\n try {\n this._callFactory();\n } catch (err) {\n this._error(err);\n }\n }\n\n private _callFactory(): void {\n const result = this.factory();\n if (result) {\n this.add(subscribeToResult(this, result));\n }\n }\n}\n"]}
|
62
node_modules/rxjs/observable/EmptyObservable.d.ts
generated
vendored
Normal file
62
node_modules/rxjs/observable/EmptyObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Observable } from '../Observable';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
export interface DispatchArg<T> {
|
||||
subscriber: Subscriber<T>;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class EmptyObservable<T> extends Observable<T> {
|
||||
private scheduler;
|
||||
/**
|
||||
* Creates an Observable that emits no items to the Observer and immediately
|
||||
* emits a complete notification.
|
||||
*
|
||||
* <span class="informal">Just emits 'complete', and nothing else.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/empty.png" width="100%">
|
||||
*
|
||||
* This static operator is useful for creating a simple Observable that only
|
||||
* emits the complete notification. It can be used for composing with other
|
||||
* Observables, such as in a {@link mergeMap}.
|
||||
*
|
||||
* @example <caption>Emit the number 7, then complete.</caption>
|
||||
* var result = Rx.Observable.empty().startWith(7);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>
|
||||
* var interval = Rx.Observable.interval(1000);
|
||||
* var result = interval.mergeMap(x =>
|
||||
* x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()
|
||||
* );
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following to the console:
|
||||
* // x is equal to the count on the interval eg(0,1,2,3,...)
|
||||
* // x will occur every 1000ms
|
||||
* // if x % 2 is equal to 1 print abc
|
||||
* // if x % 2 is not equal to 1 nothing will be output
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link never}
|
||||
* @see {@link of}
|
||||
* @see {@link throw}
|
||||
*
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
|
||||
* the emission of the complete notification.
|
||||
* @return {Observable} An "empty" Observable: emits only the complete
|
||||
* notification.
|
||||
* @static true
|
||||
* @name empty
|
||||
* @owner Observable
|
||||
*/
|
||||
static create<T>(scheduler?: IScheduler): Observable<T>;
|
||||
static dispatch<T>(arg: DispatchArg<T>): void;
|
||||
constructor(scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
81
node_modules/rxjs/observable/EmptyObservable.js
generated
vendored
Normal file
81
node_modules/rxjs/observable/EmptyObservable.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var EmptyObservable = (function (_super) {
|
||||
__extends(EmptyObservable, _super);
|
||||
function EmptyObservable(scheduler) {
|
||||
_super.call(this);
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
/**
|
||||
* Creates an Observable that emits no items to the Observer and immediately
|
||||
* emits a complete notification.
|
||||
*
|
||||
* <span class="informal">Just emits 'complete', and nothing else.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/empty.png" width="100%">
|
||||
*
|
||||
* This static operator is useful for creating a simple Observable that only
|
||||
* emits the complete notification. It can be used for composing with other
|
||||
* Observables, such as in a {@link mergeMap}.
|
||||
*
|
||||
* @example <caption>Emit the number 7, then complete.</caption>
|
||||
* var result = Rx.Observable.empty().startWith(7);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>
|
||||
* var interval = Rx.Observable.interval(1000);
|
||||
* var result = interval.mergeMap(x =>
|
||||
* x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()
|
||||
* );
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following to the console:
|
||||
* // x is equal to the count on the interval eg(0,1,2,3,...)
|
||||
* // x will occur every 1000ms
|
||||
* // if x % 2 is equal to 1 print abc
|
||||
* // if x % 2 is not equal to 1 nothing will be output
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link never}
|
||||
* @see {@link of}
|
||||
* @see {@link throw}
|
||||
*
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
|
||||
* the emission of the complete notification.
|
||||
* @return {Observable} An "empty" Observable: emits only the complete
|
||||
* notification.
|
||||
* @static true
|
||||
* @name empty
|
||||
* @owner Observable
|
||||
*/
|
||||
EmptyObservable.create = function (scheduler) {
|
||||
return new EmptyObservable(scheduler);
|
||||
};
|
||||
EmptyObservable.dispatch = function (arg) {
|
||||
var subscriber = arg.subscriber;
|
||||
subscriber.complete();
|
||||
};
|
||||
/** @deprecated internal use only */ EmptyObservable.prototype._subscribe = function (subscriber) {
|
||||
var scheduler = this.scheduler;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber });
|
||||
}
|
||||
else {
|
||||
subscriber.complete();
|
||||
}
|
||||
};
|
||||
return EmptyObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.EmptyObservable = EmptyObservable;
|
||||
//# sourceMappingURL=EmptyObservable.js.map
|
1
node_modules/rxjs/observable/EmptyObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/EmptyObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"EmptyObservable.js","sourceRoot":"","sources":["../../src/observable/EmptyObservable.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAO3C;;;;GAIG;AACH;IAAwC,mCAAa;IAsDnD,yBAAoB,SAAsB;QACxC,iBAAO,CAAC;QADU,cAAS,GAAT,SAAS,CAAa;IAE1C,CAAC;IAtDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACI,sBAAM,GAAb,UAAiB,SAAsB;QACrC,MAAM,CAAC,IAAI,eAAe,CAAI,SAAS,CAAC,CAAC;IAC3C,CAAC;IAEM,wBAAQ,GAAf,UAAmB,GAAmB;QAC5B,+BAAU,CAAS;QAC3B,UAAU,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAMD,oCAAoC,CAAC,oCAAU,GAAV,UAAW,UAAyB;QAEvE,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,sBAAU,EAAE,CAAC,CAAC;QACzE,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AApED,CAAwC,uBAAU,GAoEjD;AApEY,uBAAe,kBAoE3B,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\nimport { Subscriber } from '../Subscriber';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\n\nexport interface DispatchArg<T> {\n subscriber: Subscriber<T>;\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class EmptyObservable<T> extends Observable<T> {\n\n /**\n * Creates an Observable that emits no items to the Observer and immediately\n * emits a complete notification.\n *\n * <span class=\"informal\">Just emits 'complete', and nothing else.\n * </span>\n *\n * <img src=\"./img/empty.png\" width=\"100%\">\n *\n * This static operator is useful for creating a simple Observable that only\n * emits the complete notification. It can be used for composing with other\n * Observables, such as in a {@link mergeMap}.\n *\n * @example <caption>Emit the number 7, then complete.</caption>\n * var result = Rx.Observable.empty().startWith(7);\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>\n * var interval = Rx.Observable.interval(1000);\n * var result = interval.mergeMap(x =>\n * x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following to the console:\n * // x is equal to the count on the interval eg(0,1,2,3,...)\n * // x will occur every 1000ms\n * // if x % 2 is equal to 1 print abc\n * // if x % 2 is not equal to 1 nothing will be output\n *\n * @see {@link create}\n * @see {@link never}\n * @see {@link of}\n * @see {@link throw}\n *\n * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling\n * the emission of the complete notification.\n * @return {Observable} An \"empty\" Observable: emits only the complete\n * notification.\n * @static true\n * @name empty\n * @owner Observable\n */\n static create<T>(scheduler?: IScheduler): Observable<T> {\n return new EmptyObservable<T>(scheduler);\n }\n\n static dispatch<T>(arg: DispatchArg<T>) {\n const { subscriber } = arg;\n subscriber.complete();\n }\n\n constructor(private scheduler?: IScheduler) {\n super();\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic {\n\n const scheduler = this.scheduler;\n\n if (scheduler) {\n return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber });\n } else {\n subscriber.complete();\n }\n }\n}\n"]}
|
61
node_modules/rxjs/observable/ErrorObservable.d.ts
generated
vendored
Normal file
61
node_modules/rxjs/observable/ErrorObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
export interface DispatchArg {
|
||||
error: any;
|
||||
subscriber: any;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class ErrorObservable extends Observable<any> {
|
||||
error: any;
|
||||
private scheduler;
|
||||
/**
|
||||
* Creates an Observable that emits no items to the Observer and immediately
|
||||
* emits an error notification.
|
||||
*
|
||||
* <span class="informal">Just emits 'error', and nothing else.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/throw.png" width="100%">
|
||||
*
|
||||
* This static operator is useful for creating a simple Observable that only
|
||||
* emits the error notification. It can be used for composing with other
|
||||
* Observables, such as in a {@link mergeMap}.
|
||||
*
|
||||
* @example <caption>Emit the number 7, then emit an error.</caption>
|
||||
* var result = Rx.Observable.throw(new Error('oops!')).startWith(7);
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* @example <caption>Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13</caption>
|
||||
* var interval = Rx.Observable.interval(1000);
|
||||
* var result = interval.mergeMap(x =>
|
||||
* x === 13 ?
|
||||
* Rx.Observable.throw('Thirteens are bad') :
|
||||
* Rx.Observable.of('a', 'b', 'c')
|
||||
* );
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link empty}
|
||||
* @see {@link never}
|
||||
* @see {@link of}
|
||||
*
|
||||
* @param {any} error The particular Error to pass to the error notification.
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
|
||||
* the emission of the error notification.
|
||||
* @return {Observable} An error Observable: emits only the error notification
|
||||
* using the given error argument.
|
||||
* @static true
|
||||
* @name throw
|
||||
* @owner Observable
|
||||
*/
|
||||
static create(error: any, scheduler?: IScheduler): ErrorObservable;
|
||||
static dispatch(arg: DispatchArg): void;
|
||||
constructor(error: any, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<any>): TeardownLogic;
|
||||
}
|
83
node_modules/rxjs/observable/ErrorObservable.js
generated
vendored
Normal file
83
node_modules/rxjs/observable/ErrorObservable.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var ErrorObservable = (function (_super) {
|
||||
__extends(ErrorObservable, _super);
|
||||
function ErrorObservable(error, scheduler) {
|
||||
_super.call(this);
|
||||
this.error = error;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
/**
|
||||
* Creates an Observable that emits no items to the Observer and immediately
|
||||
* emits an error notification.
|
||||
*
|
||||
* <span class="informal">Just emits 'error', and nothing else.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/throw.png" width="100%">
|
||||
*
|
||||
* This static operator is useful for creating a simple Observable that only
|
||||
* emits the error notification. It can be used for composing with other
|
||||
* Observables, such as in a {@link mergeMap}.
|
||||
*
|
||||
* @example <caption>Emit the number 7, then emit an error.</caption>
|
||||
* var result = Rx.Observable.throw(new Error('oops!')).startWith(7);
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* @example <caption>Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13</caption>
|
||||
* var interval = Rx.Observable.interval(1000);
|
||||
* var result = interval.mergeMap(x =>
|
||||
* x === 13 ?
|
||||
* Rx.Observable.throw('Thirteens are bad') :
|
||||
* Rx.Observable.of('a', 'b', 'c')
|
||||
* );
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link empty}
|
||||
* @see {@link never}
|
||||
* @see {@link of}
|
||||
*
|
||||
* @param {any} error The particular Error to pass to the error notification.
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
|
||||
* the emission of the error notification.
|
||||
* @return {Observable} An error Observable: emits only the error notification
|
||||
* using the given error argument.
|
||||
* @static true
|
||||
* @name throw
|
||||
* @owner Observable
|
||||
*/
|
||||
ErrorObservable.create = function (error, scheduler) {
|
||||
return new ErrorObservable(error, scheduler);
|
||||
};
|
||||
ErrorObservable.dispatch = function (arg) {
|
||||
var error = arg.error, subscriber = arg.subscriber;
|
||||
subscriber.error(error);
|
||||
};
|
||||
/** @deprecated internal use only */ ErrorObservable.prototype._subscribe = function (subscriber) {
|
||||
var error = this.error;
|
||||
var scheduler = this.scheduler;
|
||||
subscriber.syncErrorThrowable = true;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(ErrorObservable.dispatch, 0, {
|
||||
error: error, subscriber: subscriber
|
||||
});
|
||||
}
|
||||
else {
|
||||
subscriber.error(error);
|
||||
}
|
||||
};
|
||||
return ErrorObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.ErrorObservable = ErrorObservable;
|
||||
//# sourceMappingURL=ErrorObservable.js.map
|
1
node_modules/rxjs/observable/ErrorObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/ErrorObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ErrorObservable.js","sourceRoot":"","sources":["../../src/observable/ErrorObservable.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAS3C;;;;GAIG;AACH;IAAqC,mCAAe;IAmDlD,yBAAmB,KAAU,EAAU,SAAsB;QAC3D,iBAAO,CAAC;QADS,UAAK,GAAL,KAAK,CAAK;QAAU,cAAS,GAAT,SAAS,CAAa;IAE7D,CAAC;IAnDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACI,sBAAM,GAAb,UAAc,KAAU,EAAE,SAAsB;QAC9C,MAAM,CAAC,IAAI,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC;IAEM,wBAAQ,GAAf,UAAgB,GAAgB;QACtB,qBAAK,EAAE,2BAAU,CAAS;QAClC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAMD,oCAAoC,CAAC,oCAAU,GAAV,UAAW,UAA2B;QACzE,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,UAAU,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAErC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACrD,YAAK,EAAE,sBAAU;aAClB,CAAC,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AArED,CAAqC,uBAAU,GAqE9C;AArEY,uBAAe,kBAqE3B,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\nimport { Subscriber } from '../Subscriber';\n\nexport interface DispatchArg {\n error: any;\n subscriber: any;\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class ErrorObservable extends Observable<any> {\n\n /**\n * Creates an Observable that emits no items to the Observer and immediately\n * emits an error notification.\n *\n * <span class=\"informal\">Just emits 'error', and nothing else.\n * </span>\n *\n * <img src=\"./img/throw.png\" width=\"100%\">\n *\n * This static operator is useful for creating a simple Observable that only\n * emits the error notification. It can be used for composing with other\n * Observables, such as in a {@link mergeMap}.\n *\n * @example <caption>Emit the number 7, then emit an error.</caption>\n * var result = Rx.Observable.throw(new Error('oops!')).startWith(7);\n * result.subscribe(x => console.log(x), e => console.error(e));\n *\n * @example <caption>Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13</caption>\n * var interval = Rx.Observable.interval(1000);\n * var result = interval.mergeMap(x =>\n * x === 13 ?\n * Rx.Observable.throw('Thirteens are bad') :\n * Rx.Observable.of('a', 'b', 'c')\n * );\n * result.subscribe(x => console.log(x), e => console.error(e));\n *\n * @see {@link create}\n * @see {@link empty}\n * @see {@link never}\n * @see {@link of}\n *\n * @param {any} error The particular Error to pass to the error notification.\n * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling\n * the emission of the error notification.\n * @return {Observable} An error Observable: emits only the error notification\n * using the given error argument.\n * @static true\n * @name throw\n * @owner Observable\n */\n static create(error: any, scheduler?: IScheduler): ErrorObservable {\n return new ErrorObservable(error, scheduler);\n }\n\n static dispatch(arg: DispatchArg) {\n const { error, subscriber } = arg;\n subscriber.error(error);\n }\n\n constructor(public error: any, private scheduler?: IScheduler) {\n super();\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<any>): TeardownLogic {\n const error = this.error;\n const scheduler = this.scheduler;\n\n subscriber.syncErrorThrowable = true;\n\n if (scheduler) {\n return scheduler.schedule(ErrorObservable.dispatch, 0, {\n error, subscriber\n });\n } else {\n subscriber.error(error);\n }\n }\n}\n"]}
|
31
node_modules/rxjs/observable/ForkJoinObservable.d.ts
generated
vendored
Normal file
31
node_modules/rxjs/observable/ForkJoinObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Observable, SubscribableOrPromise } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class ForkJoinObservable<T> extends Observable<T> {
|
||||
private sources;
|
||||
private resultSelector;
|
||||
constructor(sources: Array<SubscribableOrPromise<any>>, resultSelector?: (...values: Array<any>) => T);
|
||||
static create<T, T2>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>): Observable<[T, T2]>;
|
||||
static create<T, T2, T3>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>): Observable<[T, T2, T3]>;
|
||||
static create<T, T2, T3, T4>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>, v4: SubscribableOrPromise<T4>): Observable<[T, T2, T3, T4]>;
|
||||
static create<T, T2, T3, T4, T5>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>, v4: SubscribableOrPromise<T4>, v5: SubscribableOrPromise<T5>): Observable<[T, T2, T3, T4, T5]>;
|
||||
static create<T, T2, T3, T4, T5, T6>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>, v4: SubscribableOrPromise<T4>, v5: SubscribableOrPromise<T5>, v6: SubscribableOrPromise<T6>): Observable<[T, T2, T3, T4, T5, T6]>;
|
||||
static create<T, R>(v1: SubscribableOrPromise<T>, project: (v1: T) => R): Observable<R>;
|
||||
static create<T, T2, R>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, project: (v1: T, v2: T2) => R): Observable<R>;
|
||||
static create<T, T2, T3, R>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>, project: (v1: T, v2: T2, v3: T3) => R): Observable<R>;
|
||||
static create<T, T2, T3, T4, R>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>, v4: SubscribableOrPromise<T4>, project: (v1: T, v2: T2, v3: T3, v4: T4) => R): Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, R>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>, v4: SubscribableOrPromise<T4>, v5: SubscribableOrPromise<T5>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R): Observable<R>;
|
||||
static create<T, T2, T3, T4, T5, T6, R>(v1: SubscribableOrPromise<T>, v2: SubscribableOrPromise<T2>, v3: SubscribableOrPromise<T3>, v4: SubscribableOrPromise<T4>, v5: SubscribableOrPromise<T5>, v6: SubscribableOrPromise<T6>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R): Observable<R>;
|
||||
static create<T>(sources: SubscribableOrPromise<T>[]): Observable<T[]>;
|
||||
static create<R>(sources: SubscribableOrPromise<any>[]): Observable<R>;
|
||||
static create<T, R>(sources: SubscribableOrPromise<T>[], project: (...values: Array<T>) => R): Observable<R>;
|
||||
static create<R>(sources: SubscribableOrPromise<any>[], project: (...values: Array<any>) => R): Observable<R>;
|
||||
static create<T>(...sources: SubscribableOrPromise<T>[]): Observable<T[]>;
|
||||
static create<R>(...sources: SubscribableOrPromise<any>[]): Observable<R>;
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<any>): Subscription;
|
||||
}
|
202
node_modules/rxjs/observable/ForkJoinObservable.js
generated
vendored
Normal file
202
node_modules/rxjs/observable/ForkJoinObservable.js
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var EmptyObservable_1 = require('./EmptyObservable');
|
||||
var isArray_1 = require('../util/isArray');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var ForkJoinObservable = (function (_super) {
|
||||
__extends(ForkJoinObservable, _super);
|
||||
function ForkJoinObservable(sources, resultSelector) {
|
||||
_super.call(this);
|
||||
this.sources = sources;
|
||||
this.resultSelector = resultSelector;
|
||||
}
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Joins last values emitted by passed Observables.
|
||||
*
|
||||
* <span class="informal">Wait for Observables to complete and then combine last values they emitted.</span>
|
||||
*
|
||||
* <img src="./img/forkJoin.png" width="100%">
|
||||
*
|
||||
* `forkJoin` is an operator that takes any number of Observables which can be passed either as an array
|
||||
* or directly as arguments. If no input Observables are provided, resulting stream will complete
|
||||
* immediately.
|
||||
*
|
||||
* `forkJoin` will wait for all passed Observables to complete and then it will emit an array with last
|
||||
* values from corresponding Observables. So if you pass `n` Observables to the operator, resulting
|
||||
* array will have `n` values, where first value is the last thing emitted by the first Observable,
|
||||
* second value is the last thing emitted by the second Observable and so on. That means `forkJoin` will
|
||||
* not emit more than once and it will complete after that. If you need to emit combined values not only
|
||||
* at the end of lifecycle of passed Observables, but also throughout it, try out {@link combineLatest}
|
||||
* or {@link zip} instead.
|
||||
*
|
||||
* In order for resulting array to have the same length as the number of input Observables, whenever any of
|
||||
* that Observables completes without emitting any value, `forkJoin` will complete at that moment as well
|
||||
* and it will not emit anything either, even if it already has some last values from other Observables.
|
||||
* Conversely, if there is an Observable that never completes, `forkJoin` will never complete as well,
|
||||
* unless at any point some other Observable completes without emitting value, which brings us back to
|
||||
* the previous case. Overall, in order for `forkJoin` to emit a value, all Observables passed as arguments
|
||||
* have to emit something at least once and complete.
|
||||
*
|
||||
* If any input Observable errors at some point, `forkJoin` will error as well and all other Observables
|
||||
* will be immediately unsubscribed.
|
||||
*
|
||||
* Optionally `forkJoin` accepts project function, that will be called with values which normally
|
||||
* would land in emitted array. Whatever is returned by project function, will appear in output
|
||||
* Observable instead. This means that default project can be thought of as a function that takes
|
||||
* all its arguments and puts them into an array. Note that project function will be called only
|
||||
* when output Observable is supposed to emit a result.
|
||||
*
|
||||
* @example <caption>Use forkJoin with operator emitting immediately</caption>
|
||||
* const observable = Rx.Observable.forkJoin(
|
||||
* Rx.Observable.of(1, 2, 3, 4),
|
||||
* Rx.Observable.of(5, 6, 7, 8)
|
||||
* );
|
||||
* observable.subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('This is how it ends!')
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // [4, 8]
|
||||
* // "This is how it ends!"
|
||||
*
|
||||
*
|
||||
* @example <caption>Use forkJoin with operator emitting after some time</caption>
|
||||
* const observable = Rx.Observable.forkJoin(
|
||||
* Rx.Observable.interval(1000).take(3), // emit 0, 1, 2 every second and complete
|
||||
* Rx.Observable.interval(500).take(4) // emit 0, 1, 2, 3 every half a second and complete
|
||||
* );
|
||||
* observable.subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('This is how it ends!')
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // [2, 3] after 3 seconds
|
||||
* // "This is how it ends!" immediately after
|
||||
*
|
||||
*
|
||||
* @example <caption>Use forkJoin with project function</caption>
|
||||
* const observable = Rx.Observable.forkJoin(
|
||||
* Rx.Observable.interval(1000).take(3), // emit 0, 1, 2 every second and complete
|
||||
* Rx.Observable.interval(500).take(4), // emit 0, 1, 2, 3 every half a second and complete
|
||||
* (n, m) => n + m
|
||||
* );
|
||||
* observable.subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('This is how it ends!')
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // 5 after 3 seconds
|
||||
* // "This is how it ends!" immediately after
|
||||
*
|
||||
* @see {@link combineLatest}
|
||||
* @see {@link zip}
|
||||
*
|
||||
* @param {...SubscribableOrPromise} sources Any number of Observables provided either as an array or as an arguments
|
||||
* passed directly to the operator.
|
||||
* @param {function} [project] Function that takes values emitted by input Observables and returns value
|
||||
* that will appear in resulting Observable instead of default array.
|
||||
* @return {Observable} Observable emitting either an array of last values emitted by passed Observables
|
||||
* or value from project function.
|
||||
* @static true
|
||||
* @name forkJoin
|
||||
* @owner Observable
|
||||
*/
|
||||
ForkJoinObservable.create = function () {
|
||||
var sources = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
sources[_i - 0] = arguments[_i];
|
||||
}
|
||||
if (sources === null || arguments.length === 0) {
|
||||
return new EmptyObservable_1.EmptyObservable();
|
||||
}
|
||||
var resultSelector = null;
|
||||
if (typeof sources[sources.length - 1] === 'function') {
|
||||
resultSelector = sources.pop();
|
||||
}
|
||||
// if the first and only other argument besides the resultSelector is an array
|
||||
// assume it's been called with `forkJoin([obs1, obs2, obs3], resultSelector)`
|
||||
if (sources.length === 1 && isArray_1.isArray(sources[0])) {
|
||||
sources = sources[0];
|
||||
}
|
||||
if (sources.length === 0) {
|
||||
return new EmptyObservable_1.EmptyObservable();
|
||||
}
|
||||
return new ForkJoinObservable(sources, resultSelector);
|
||||
};
|
||||
/** @deprecated internal use only */ ForkJoinObservable.prototype._subscribe = function (subscriber) {
|
||||
return new ForkJoinSubscriber(subscriber, this.sources, this.resultSelector);
|
||||
};
|
||||
return ForkJoinObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.ForkJoinObservable = ForkJoinObservable;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var ForkJoinSubscriber = (function (_super) {
|
||||
__extends(ForkJoinSubscriber, _super);
|
||||
function ForkJoinSubscriber(destination, sources, resultSelector) {
|
||||
_super.call(this, destination);
|
||||
this.sources = sources;
|
||||
this.resultSelector = resultSelector;
|
||||
this.completed = 0;
|
||||
this.haveValues = 0;
|
||||
var len = sources.length;
|
||||
this.total = len;
|
||||
this.values = new Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var source = sources[i];
|
||||
var innerSubscription = subscribeToResult_1.subscribeToResult(this, source, null, i);
|
||||
if (innerSubscription) {
|
||||
innerSubscription.outerIndex = i;
|
||||
this.add(innerSubscription);
|
||||
}
|
||||
}
|
||||
}
|
||||
ForkJoinSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
|
||||
this.values[outerIndex] = innerValue;
|
||||
if (!innerSub._hasValue) {
|
||||
innerSub._hasValue = true;
|
||||
this.haveValues++;
|
||||
}
|
||||
};
|
||||
ForkJoinSubscriber.prototype.notifyComplete = function (innerSub) {
|
||||
var destination = this.destination;
|
||||
var _a = this, haveValues = _a.haveValues, resultSelector = _a.resultSelector, values = _a.values;
|
||||
var len = values.length;
|
||||
if (!innerSub._hasValue) {
|
||||
destination.complete();
|
||||
return;
|
||||
}
|
||||
this.completed++;
|
||||
if (this.completed !== len) {
|
||||
return;
|
||||
}
|
||||
if (haveValues === len) {
|
||||
var value = resultSelector ? resultSelector.apply(this, values) : values;
|
||||
destination.next(value);
|
||||
}
|
||||
destination.complete();
|
||||
};
|
||||
return ForkJoinSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=ForkJoinObservable.js.map
|
1
node_modules/rxjs/observable/ForkJoinObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/ForkJoinObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
36
node_modules/rxjs/observable/FromEventObservable.d.ts
generated
vendored
Normal file
36
node_modules/rxjs/observable/FromEventObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
export declare type NodeStyleEventEmitter = {
|
||||
addListener: (eventName: string, handler: NodeEventHandler) => void;
|
||||
removeListener: (eventName: string, handler: NodeEventHandler) => void;
|
||||
};
|
||||
export declare type NodeEventHandler = (...args: any[]) => void;
|
||||
export declare type JQueryStyleEventEmitter = {
|
||||
on: (eventName: string, handler: Function) => void;
|
||||
off: (eventName: string, handler: Function) => void;
|
||||
};
|
||||
export declare type EventTargetLike = EventTarget | NodeStyleEventEmitter | JQueryStyleEventEmitter | NodeList | HTMLCollection;
|
||||
export declare type EventListenerOptions = {
|
||||
capture?: boolean;
|
||||
passive?: boolean;
|
||||
once?: boolean;
|
||||
} | boolean;
|
||||
export declare type SelectorMethodSignature<T> = (...args: Array<any>) => T;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class FromEventObservable<T> extends Observable<T> {
|
||||
private sourceObj;
|
||||
private eventName;
|
||||
private selector;
|
||||
private options;
|
||||
static create<T>(target: EventTargetLike, eventName: string): Observable<T>;
|
||||
static create<T>(target: EventTargetLike, eventName: string, selector: SelectorMethodSignature<T>): Observable<T>;
|
||||
static create<T>(target: EventTargetLike, eventName: string, options: EventListenerOptions): Observable<T>;
|
||||
static create<T>(target: EventTargetLike, eventName: string, options: EventListenerOptions, selector: SelectorMethodSignature<T>): Observable<T>;
|
||||
constructor(sourceObj: EventTargetLike, eventName: string, selector?: SelectorMethodSignature<T>, options?: EventListenerOptions);
|
||||
private static setupSubscription<T>(sourceObj, eventName, handler, subscriber, options?);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): void;
|
||||
}
|
216
node_modules/rxjs/observable/FromEventObservable.js
generated
vendored
Normal file
216
node_modules/rxjs/observable/FromEventObservable.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var tryCatch_1 = require('../util/tryCatch');
|
||||
var isFunction_1 = require('../util/isFunction');
|
||||
var errorObject_1 = require('../util/errorObject');
|
||||
var Subscription_1 = require('../Subscription');
|
||||
var toString = Object.prototype.toString;
|
||||
function isNodeStyleEventEmitter(sourceObj) {
|
||||
return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
|
||||
}
|
||||
function isJQueryStyleEventEmitter(sourceObj) {
|
||||
return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
|
||||
}
|
||||
function isNodeList(sourceObj) {
|
||||
return !!sourceObj && toString.call(sourceObj) === '[object NodeList]';
|
||||
}
|
||||
function isHTMLCollection(sourceObj) {
|
||||
return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]';
|
||||
}
|
||||
function isEventTarget(sourceObj) {
|
||||
return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var FromEventObservable = (function (_super) {
|
||||
__extends(FromEventObservable, _super);
|
||||
function FromEventObservable(sourceObj, eventName, selector, options) {
|
||||
_super.call(this);
|
||||
this.sourceObj = sourceObj;
|
||||
this.eventName = eventName;
|
||||
this.selector = selector;
|
||||
this.options = options;
|
||||
}
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Creates an Observable that emits events of a specific type coming from the
|
||||
* given event target.
|
||||
*
|
||||
* <span class="informal">Creates an Observable from DOM events, or Node.js
|
||||
* EventEmitter events or others.</span>
|
||||
*
|
||||
* <img src="./img/fromEvent.png" width="100%">
|
||||
*
|
||||
* `fromEvent` accepts as a first argument event target, which is an object with methods
|
||||
* for registering event handler functions. As a second argument it takes string that indicates
|
||||
* type of event we want to listen for. `fromEvent` supports selected types of event targets,
|
||||
* which are described in detail below. If your event target does not match any of the ones listed,
|
||||
* you should use {@link fromEventPattern}, which can be used on arbitrary APIs.
|
||||
* When it comes to APIs supported by `fromEvent`, their methods for adding and removing event
|
||||
* handler functions have different names, but they all accept a string describing event type
|
||||
* and function itself, which will be called whenever said event happens.
|
||||
*
|
||||
* Every time resulting Observable is subscribed, event handler function will be registered
|
||||
* to event target on given event type. When that event fires, value
|
||||
* passed as a first argument to registered function will be emitted by output Observable.
|
||||
* When Observable is unsubscribed, function will be unregistered from event target.
|
||||
*
|
||||
* Note that if event target calls registered function with more than one argument, second
|
||||
* and following arguments will not appear in resulting stream. In order to get access to them,
|
||||
* you can pass to `fromEvent` optional project function, which will be called with all arguments
|
||||
* passed to event handler. Output Observable will then emit value returned by project function,
|
||||
* instead of the usual value.
|
||||
*
|
||||
* Remember that event targets listed below are checked via duck typing. It means that
|
||||
* no matter what kind of object you have and no matter what environment you work in,
|
||||
* you can safely use `fromEvent` on that object if it exposes described methods (provided
|
||||
* of course they behave as was described above). So for example if Node.js library exposes
|
||||
* event target which has the same method names as DOM EventTarget, `fromEvent` is still
|
||||
* a good choice.
|
||||
*
|
||||
* If the API you use is more callback then event handler oriented (subscribed
|
||||
* callback function fires only once and thus there is no need to manually
|
||||
* unregister it), you should use {@link bindCallback} or {@link bindNodeCallback}
|
||||
* instead.
|
||||
*
|
||||
* `fromEvent` supports following types of event targets:
|
||||
*
|
||||
* **DOM EventTarget**
|
||||
*
|
||||
* This is an object with `addEventListener` and `removeEventListener` methods.
|
||||
*
|
||||
* In the browser, `addEventListener` accepts - apart from event type string and event
|
||||
* handler function arguments - optional third parameter, which is either an object or boolean,
|
||||
* both used for additional configuration how and when passed function will be called. When
|
||||
* `fromEvent` is used with event target of that type, you can provide this values
|
||||
* as third parameter as well.
|
||||
*
|
||||
* **Node.js EventEmitter**
|
||||
*
|
||||
* An object with `addListener` and `removeListener` methods.
|
||||
*
|
||||
* **JQuery-style event target**
|
||||
*
|
||||
* An object with `on` and `off` methods
|
||||
*
|
||||
* **DOM NodeList**
|
||||
*
|
||||
* List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`.
|
||||
*
|
||||
* Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes
|
||||
* it contains and install event handler function in every of them. When returned Observable
|
||||
* is unsubscribed, function will be removed from all Nodes.
|
||||
*
|
||||
* **DOM HtmlCollection**
|
||||
*
|
||||
* Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is
|
||||
* installed and removed in each of elements.
|
||||
*
|
||||
*
|
||||
* @example <caption>Emits clicks happening on the DOM document</caption>
|
||||
* var clicks = Rx.Observable.fromEvent(document, 'click');
|
||||
* clicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in:
|
||||
* // MouseEvent object logged to console every time a click
|
||||
* // occurs on the document.
|
||||
*
|
||||
*
|
||||
* @example <caption>Use addEventListener with capture option</caption>
|
||||
* var clicksInDocument = Rx.Observable.fromEvent(document, 'click', true); // note optional configuration parameter
|
||||
* // which will be passed to addEventListener
|
||||
* var clicksInDiv = Rx.Observable.fromEvent(someDivInDocument, 'click');
|
||||
*
|
||||
* clicksInDocument.subscribe(() => console.log('document'));
|
||||
* clicksInDiv.subscribe(() => console.log('div'));
|
||||
*
|
||||
* // By default events bubble UP in DOM tree, so normally
|
||||
* // when we would click on div in document
|
||||
* // "div" would be logged first and then "document".
|
||||
* // Since we specified optional `capture` option, document
|
||||
* // will catch event when it goes DOWN DOM tree, so console
|
||||
* // will log "document" and then "div".
|
||||
*
|
||||
* @see {@link bindCallback}
|
||||
* @see {@link bindNodeCallback}
|
||||
* @see {@link fromEventPattern}
|
||||
*
|
||||
* @param {EventTargetLike} target The DOM EventTarget, Node.js
|
||||
* EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to.
|
||||
* @param {string} eventName The event name of interest, being emitted by the
|
||||
* `target`.
|
||||
* @param {EventListenerOptions} [options] Options to pass through to addEventListener
|
||||
* @param {SelectorMethodSignature<T>} [selector] An optional function to
|
||||
* post-process results. It takes the arguments from the event handler and
|
||||
* should return a single value.
|
||||
* @return {Observable<T>}
|
||||
* @static true
|
||||
* @name fromEvent
|
||||
* @owner Observable
|
||||
*/
|
||||
FromEventObservable.create = function (target, eventName, options, selector) {
|
||||
if (isFunction_1.isFunction(options)) {
|
||||
selector = options;
|
||||
options = undefined;
|
||||
}
|
||||
return new FromEventObservable(target, eventName, selector, options);
|
||||
};
|
||||
FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) {
|
||||
var unsubscribe;
|
||||
if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
|
||||
for (var i = 0, len = sourceObj.length; i < len; i++) {
|
||||
FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
|
||||
}
|
||||
}
|
||||
else if (isEventTarget(sourceObj)) {
|
||||
var source_1 = sourceObj;
|
||||
sourceObj.addEventListener(eventName, handler, options);
|
||||
unsubscribe = function () { return source_1.removeEventListener(eventName, handler, options); };
|
||||
}
|
||||
else if (isJQueryStyleEventEmitter(sourceObj)) {
|
||||
var source_2 = sourceObj;
|
||||
sourceObj.on(eventName, handler);
|
||||
unsubscribe = function () { return source_2.off(eventName, handler); };
|
||||
}
|
||||
else if (isNodeStyleEventEmitter(sourceObj)) {
|
||||
var source_3 = sourceObj;
|
||||
sourceObj.addListener(eventName, handler);
|
||||
unsubscribe = function () { return source_3.removeListener(eventName, handler); };
|
||||
}
|
||||
else {
|
||||
throw new TypeError('Invalid event target');
|
||||
}
|
||||
subscriber.add(new Subscription_1.Subscription(unsubscribe));
|
||||
};
|
||||
/** @deprecated internal use only */ FromEventObservable.prototype._subscribe = function (subscriber) {
|
||||
var sourceObj = this.sourceObj;
|
||||
var eventName = this.eventName;
|
||||
var options = this.options;
|
||||
var selector = this.selector;
|
||||
var handler = selector ? function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
var result = tryCatch_1.tryCatch(selector).apply(void 0, args);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
subscriber.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
subscriber.next(result);
|
||||
}
|
||||
} : function (e) { return subscriber.next(e); };
|
||||
FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options);
|
||||
};
|
||||
return FromEventObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.FromEventObservable = FromEventObservable;
|
||||
//# sourceMappingURL=FromEventObservable.js.map
|
1
node_modules/rxjs/observable/FromEventObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/FromEventObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
65
node_modules/rxjs/observable/FromEventPatternObservable.d.ts
generated
vendored
Normal file
65
node_modules/rxjs/observable/FromEventPatternObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class FromEventPatternObservable<T> extends Observable<T> {
|
||||
private addHandler;
|
||||
private removeHandler;
|
||||
private selector;
|
||||
/**
|
||||
* Creates an Observable from an API based on addHandler/removeHandler
|
||||
* functions.
|
||||
*
|
||||
* <span class="informal">Converts any addHandler/removeHandler API to an
|
||||
* Observable.</span>
|
||||
*
|
||||
* <img src="./img/fromEventPattern.png" width="100%">
|
||||
*
|
||||
* Creates an Observable by using the `addHandler` and `removeHandler`
|
||||
* functions to add and remove the handlers, with an optional selector
|
||||
* function to project the event arguments to a result. The `addHandler` is
|
||||
* called when the output Observable is subscribed, and `removeHandler` is
|
||||
* called when the Subscription is unsubscribed.
|
||||
*
|
||||
* @example <caption>Emits clicks happening on the DOM document</caption>
|
||||
* function addClickHandler(handler) {
|
||||
* document.addEventListener('click', handler);
|
||||
* }
|
||||
*
|
||||
* function removeClickHandler(handler) {
|
||||
* document.removeEventListener('click', handler);
|
||||
* }
|
||||
*
|
||||
* var clicks = Rx.Observable.fromEventPattern(
|
||||
* addClickHandler,
|
||||
* removeClickHandler
|
||||
* );
|
||||
* clicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link fromEvent}
|
||||
*
|
||||
* @param {function(handler: Function): any} addHandler A function that takes
|
||||
* a `handler` function as argument and attaches it somehow to the actual
|
||||
* source of events.
|
||||
* @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that
|
||||
* takes a `handler` function as argument and removes it in case it was
|
||||
* previously attached using `addHandler`. if addHandler returns signal to teardown when remove,
|
||||
* removeHandler function will forward it.
|
||||
* @param {function(...args: any): T} [selector] An optional function to
|
||||
* post-process results. It takes the arguments from the event handler and
|
||||
* should return a single value.
|
||||
* @return {Observable<T>}
|
||||
* @static true
|
||||
* @name fromEventPattern
|
||||
* @owner Observable
|
||||
*/
|
||||
static create<T>(addHandler: (handler: Function) => any, removeHandler?: (handler: Function, signal?: any) => void, selector?: (...args: Array<any>) => T): FromEventPatternObservable<T>;
|
||||
constructor(addHandler: (handler: Function) => any, removeHandler?: (handler: Function, signal?: any) => void, selector?: (...args: Array<any>) => T);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): void;
|
||||
private _callSelector(subscriber, args);
|
||||
private _callAddHandler(handler, errorSubscriber);
|
||||
}
|
113
node_modules/rxjs/observable/FromEventPatternObservable.js
generated
vendored
Normal file
113
node_modules/rxjs/observable/FromEventPatternObservable.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var isFunction_1 = require('../util/isFunction');
|
||||
var Observable_1 = require('../Observable');
|
||||
var Subscription_1 = require('../Subscription');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var FromEventPatternObservable = (function (_super) {
|
||||
__extends(FromEventPatternObservable, _super);
|
||||
function FromEventPatternObservable(addHandler, removeHandler, selector) {
|
||||
_super.call(this);
|
||||
this.addHandler = addHandler;
|
||||
this.removeHandler = removeHandler;
|
||||
this.selector = selector;
|
||||
}
|
||||
/**
|
||||
* Creates an Observable from an API based on addHandler/removeHandler
|
||||
* functions.
|
||||
*
|
||||
* <span class="informal">Converts any addHandler/removeHandler API to an
|
||||
* Observable.</span>
|
||||
*
|
||||
* <img src="./img/fromEventPattern.png" width="100%">
|
||||
*
|
||||
* Creates an Observable by using the `addHandler` and `removeHandler`
|
||||
* functions to add and remove the handlers, with an optional selector
|
||||
* function to project the event arguments to a result. The `addHandler` is
|
||||
* called when the output Observable is subscribed, and `removeHandler` is
|
||||
* called when the Subscription is unsubscribed.
|
||||
*
|
||||
* @example <caption>Emits clicks happening on the DOM document</caption>
|
||||
* function addClickHandler(handler) {
|
||||
* document.addEventListener('click', handler);
|
||||
* }
|
||||
*
|
||||
* function removeClickHandler(handler) {
|
||||
* document.removeEventListener('click', handler);
|
||||
* }
|
||||
*
|
||||
* var clicks = Rx.Observable.fromEventPattern(
|
||||
* addClickHandler,
|
||||
* removeClickHandler
|
||||
* );
|
||||
* clicks.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link fromEvent}
|
||||
*
|
||||
* @param {function(handler: Function): any} addHandler A function that takes
|
||||
* a `handler` function as argument and attaches it somehow to the actual
|
||||
* source of events.
|
||||
* @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that
|
||||
* takes a `handler` function as argument and removes it in case it was
|
||||
* previously attached using `addHandler`. if addHandler returns signal to teardown when remove,
|
||||
* removeHandler function will forward it.
|
||||
* @param {function(...args: any): T} [selector] An optional function to
|
||||
* post-process results. It takes the arguments from the event handler and
|
||||
* should return a single value.
|
||||
* @return {Observable<T>}
|
||||
* @static true
|
||||
* @name fromEventPattern
|
||||
* @owner Observable
|
||||
*/
|
||||
FromEventPatternObservable.create = function (addHandler, removeHandler, selector) {
|
||||
return new FromEventPatternObservable(addHandler, removeHandler, selector);
|
||||
};
|
||||
/** @deprecated internal use only */ FromEventPatternObservable.prototype._subscribe = function (subscriber) {
|
||||
var _this = this;
|
||||
var removeHandler = this.removeHandler;
|
||||
var handler = !!this.selector ? function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
_this._callSelector(subscriber, args);
|
||||
} : function (e) { subscriber.next(e); };
|
||||
var retValue = this._callAddHandler(handler, subscriber);
|
||||
if (!isFunction_1.isFunction(removeHandler)) {
|
||||
return;
|
||||
}
|
||||
subscriber.add(new Subscription_1.Subscription(function () {
|
||||
//TODO: determine whether or not to forward to error handler
|
||||
removeHandler(handler, retValue);
|
||||
}));
|
||||
};
|
||||
FromEventPatternObservable.prototype._callSelector = function (subscriber, args) {
|
||||
try {
|
||||
var result = this.selector.apply(this, args);
|
||||
subscriber.next(result);
|
||||
}
|
||||
catch (e) {
|
||||
subscriber.error(e);
|
||||
}
|
||||
};
|
||||
FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) {
|
||||
try {
|
||||
return this.addHandler(handler) || null;
|
||||
}
|
||||
catch (e) {
|
||||
errorSubscriber.error(e);
|
||||
}
|
||||
};
|
||||
return FromEventPatternObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.FromEventPatternObservable = FromEventPatternObservable;
|
||||
//# sourceMappingURL=FromEventPatternObservable.js.map
|
1
node_modules/rxjs/observable/FromEventPatternObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/FromEventPatternObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/rxjs/observable/FromObservable.d.ts
generated
vendored
Normal file
16
node_modules/rxjs/observable/FromObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable, ObservableInput } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class FromObservable<T> extends Observable<T> {
|
||||
private ish;
|
||||
private scheduler;
|
||||
constructor(ish: ObservableInput<T>, scheduler?: IScheduler);
|
||||
static create<T>(ish: ObservableInput<T>, scheduler?: IScheduler): Observable<T>;
|
||||
static create<T, R>(ish: ArrayLike<T>, scheduler?: IScheduler): Observable<R>;
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): any;
|
||||
}
|
122
node_modules/rxjs/observable/FromObservable.js
generated
vendored
Normal file
122
node_modules/rxjs/observable/FromObservable.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var isArray_1 = require('../util/isArray');
|
||||
var isArrayLike_1 = require('../util/isArrayLike');
|
||||
var isPromise_1 = require('../util/isPromise');
|
||||
var PromiseObservable_1 = require('./PromiseObservable');
|
||||
var IteratorObservable_1 = require('./IteratorObservable');
|
||||
var ArrayObservable_1 = require('./ArrayObservable');
|
||||
var ArrayLikeObservable_1 = require('./ArrayLikeObservable');
|
||||
var iterator_1 = require('../symbol/iterator');
|
||||
var Observable_1 = require('../Observable');
|
||||
var observeOn_1 = require('../operators/observeOn');
|
||||
var observable_1 = require('../symbol/observable');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var FromObservable = (function (_super) {
|
||||
__extends(FromObservable, _super);
|
||||
function FromObservable(ish, scheduler) {
|
||||
_super.call(this, null);
|
||||
this.ish = ish;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
/**
|
||||
* Creates an Observable from an Array, an array-like object, a Promise, an
|
||||
* iterable object, or an Observable-like object.
|
||||
*
|
||||
* <span class="informal">Converts almost anything to an Observable.</span>
|
||||
*
|
||||
* <img src="./img/from.png" width="100%">
|
||||
*
|
||||
* Convert various other objects and data types into Observables. `from`
|
||||
* converts a Promise or an array-like or an
|
||||
* [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable)
|
||||
* object into an Observable that emits the items in that promise or array or
|
||||
* iterable. A String, in this context, is treated as an array of characters.
|
||||
* Observable-like objects (contains a function named with the ES2015 Symbol
|
||||
* for Observable) can also be converted through this operator.
|
||||
*
|
||||
* @example <caption>Converts an array to an Observable</caption>
|
||||
* var array = [10, 20, 30];
|
||||
* var result = Rx.Observable.from(array);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // 10 20 30
|
||||
*
|
||||
* @example <caption>Convert an infinite iterable (from a generator) to an Observable</caption>
|
||||
* function* generateDoubles(seed) {
|
||||
* var i = seed;
|
||||
* while (true) {
|
||||
* yield i;
|
||||
* i = 2 * i; // double it
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* var iterator = generateDoubles(3);
|
||||
* var result = Rx.Observable.from(iterator).take(10);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Results in the following:
|
||||
* // 3 6 12 24 48 96 192 384 768 1536
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link fromEvent}
|
||||
* @see {@link fromEventPattern}
|
||||
* @see {@link fromPromise}
|
||||
*
|
||||
* @param {ObservableInput<T>} ish A subscribable object, a Promise, an
|
||||
* Observable-like, an Array, an iterable or an array-like object to be
|
||||
* converted.
|
||||
* @param {Scheduler} [scheduler] The scheduler on which to schedule the
|
||||
* emissions of values.
|
||||
* @return {Observable<T>} The Observable whose values are originally from the
|
||||
* input object that was converted.
|
||||
* @static true
|
||||
* @name from
|
||||
* @owner Observable
|
||||
*/
|
||||
FromObservable.create = function (ish, scheduler) {
|
||||
if (ish != null) {
|
||||
if (typeof ish[observable_1.observable] === 'function') {
|
||||
if (ish instanceof Observable_1.Observable && !scheduler) {
|
||||
return ish;
|
||||
}
|
||||
return new FromObservable(ish, scheduler);
|
||||
}
|
||||
else if (isArray_1.isArray(ish)) {
|
||||
return new ArrayObservable_1.ArrayObservable(ish, scheduler);
|
||||
}
|
||||
else if (isPromise_1.isPromise(ish)) {
|
||||
return new PromiseObservable_1.PromiseObservable(ish, scheduler);
|
||||
}
|
||||
else if (typeof ish[iterator_1.iterator] === 'function' || typeof ish === 'string') {
|
||||
return new IteratorObservable_1.IteratorObservable(ish, scheduler);
|
||||
}
|
||||
else if (isArrayLike_1.isArrayLike(ish)) {
|
||||
return new ArrayLikeObservable_1.ArrayLikeObservable(ish, scheduler);
|
||||
}
|
||||
}
|
||||
throw new TypeError((ish !== null && typeof ish || ish) + ' is not observable');
|
||||
};
|
||||
/** @deprecated internal use only */ FromObservable.prototype._subscribe = function (subscriber) {
|
||||
var ish = this.ish;
|
||||
var scheduler = this.scheduler;
|
||||
if (scheduler == null) {
|
||||
return ish[observable_1.observable]().subscribe(subscriber);
|
||||
}
|
||||
else {
|
||||
return ish[observable_1.observable]().subscribe(new observeOn_1.ObserveOnSubscriber(subscriber, scheduler, 0));
|
||||
}
|
||||
};
|
||||
return FromObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.FromObservable = FromObservable;
|
||||
//# sourceMappingURL=FromObservable.js.map
|
1
node_modules/rxjs/observable/FromObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/FromObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
144
node_modules/rxjs/observable/GenerateObservable.d.ts
generated
vendored
Normal file
144
node_modules/rxjs/observable/GenerateObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
export declare type ConditionFunc<S> = (state: S) => boolean;
|
||||
export declare type IterateFunc<S> = (state: S) => S;
|
||||
export declare type ResultFunc<S, T> = (state: S) => T;
|
||||
export interface GenerateBaseOptions<S> {
|
||||
/**
|
||||
* Initial state.
|
||||
*/
|
||||
initialState: S;
|
||||
/**
|
||||
* Condition function that accepts state and returns boolean.
|
||||
* When it returns false, the generator stops.
|
||||
* If not specified, a generator never stops.
|
||||
*/
|
||||
condition?: ConditionFunc<S>;
|
||||
/**
|
||||
* Iterate function that accepts state and returns new state.
|
||||
*/
|
||||
iterate: IterateFunc<S>;
|
||||
/**
|
||||
* IScheduler to use for generation process.
|
||||
* By default, a generator starts immediately.
|
||||
*/
|
||||
scheduler?: IScheduler;
|
||||
}
|
||||
export interface GenerateOptions<T, S> extends GenerateBaseOptions<S> {
|
||||
/**
|
||||
* Result selection function that accepts state and returns a value to emit.
|
||||
*/
|
||||
resultSelector: ResultFunc<S, T>;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class GenerateObservable<T, S> extends Observable<T> {
|
||||
private initialState;
|
||||
private condition;
|
||||
private iterate;
|
||||
private resultSelector;
|
||||
private scheduler;
|
||||
constructor(initialState: S, condition: ConditionFunc<S>, iterate: IterateFunc<S>, resultSelector: ResultFunc<S, T>, scheduler?: IScheduler);
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
*
|
||||
* <img src="./img/generate.png" width="100%">
|
||||
*
|
||||
* @example <caption>Produces sequence of 0, 1, 2, ... 9, then completes.</caption>
|
||||
* var res = Rx.Observable.generate(0, x => x < 10, x => x + 1, x => x);
|
||||
*
|
||||
* @example <caption>Using asap scheduler, produces sequence of 2, 3, 5, then completes.</caption>
|
||||
* var res = Rx.Observable.generate(1, x => x < 5, x => x * 2, x => x + 1, Rx.Scheduler.asap);
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link create}
|
||||
*
|
||||
* @param {S} initialState Initial state.
|
||||
* @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).
|
||||
* @param {function (state: S): S} iterate Iteration step function.
|
||||
* @param {function (state: S): T} resultSelector Selector function for results produced in the sequence.
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} on which to run the generator loop. If not provided, defaults to emit immediately.
|
||||
* @returns {Observable<T>} The generated sequence.
|
||||
*/
|
||||
static create<T, S>(initialState: S, condition: ConditionFunc<S>, iterate: IterateFunc<S>, resultSelector: ResultFunc<S, T>, scheduler?: IScheduler): Observable<T>;
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
* The overload uses state as an emitted value.
|
||||
*
|
||||
* <img src="./img/generate.png" width="100%">
|
||||
*
|
||||
* @example <caption>Produces sequence of 0, 1, 2, ... 9, then completes.</caption>
|
||||
* var res = Rx.Observable.generate(0, x => x < 10, x => x + 1);
|
||||
*
|
||||
* @example <caption>Using asap scheduler, produces sequence of 1, 2, 4, then completes.</caption>
|
||||
* var res = Rx.Observable.generate(1, x => x < 5, x => x * 2, Rx.Scheduler.asap);
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link create}
|
||||
*
|
||||
* @param {S} initialState Initial state.
|
||||
* @param {function (state: S): boolean} condition Condition to terminate generation (upon returning false).
|
||||
* @param {function (state: S): S} iterate Iteration step function.
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} on which to run the generator loop. If not provided, defaults to emit immediately.
|
||||
* @returns {Observable<S>} The generated sequence.
|
||||
*/
|
||||
static create<S>(initialState: S, condition: ConditionFunc<S>, iterate: IterateFunc<S>, scheduler?: IScheduler): Observable<S>;
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
* The overload accepts options object that might contain initial state, iterate,
|
||||
* condition and scheduler.
|
||||
*
|
||||
* <img src="./img/generate.png" width="100%">
|
||||
*
|
||||
* @example <caption>Produces sequence of 0, 1, 2, ... 9, then completes.</caption>
|
||||
* var res = Rx.Observable.generate({
|
||||
* initialState: 0,
|
||||
* condition: x => x < 10,
|
||||
* iterate: x => x + 1
|
||||
* });
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link create}
|
||||
*
|
||||
* @param {GenerateBaseOptions<S>} options Object that must contain initialState, iterate and might contain condition and scheduler.
|
||||
* @returns {Observable<S>} The generated sequence.
|
||||
*/
|
||||
static create<S>(options: GenerateBaseOptions<S>): Observable<S>;
|
||||
/**
|
||||
* Generates an observable sequence by running a state-driven loop
|
||||
* producing the sequence's elements, using the specified scheduler
|
||||
* to send out observer messages.
|
||||
* The overload accepts options object that might contain initial state, iterate,
|
||||
* condition, result selector and scheduler.
|
||||
*
|
||||
* <img src="./img/generate.png" width="100%">
|
||||
*
|
||||
* @example <caption>Produces sequence of 0, 1, 2, ... 9, then completes.</caption>
|
||||
* var res = Rx.Observable.generate({
|
||||
* initialState: 0,
|
||||
* condition: x => x < 10,
|
||||
* iterate: x => x + 1,
|
||||
* resultSelector: x => x
|
||||
* });
|
||||
*
|
||||
* @see {@link from}
|
||||
* @see {@link create}
|
||||
*
|
||||
* @param {GenerateOptions<T, S>} options Object that must contain initialState, iterate, resultSelector and might contain condition and scheduler.
|
||||
* @returns {Observable<T>} The generated sequence.
|
||||
*/
|
||||
static create<T, S>(options: GenerateOptions<T, S>): Observable<T>;
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<any>): Subscription | Function | void;
|
||||
private static dispatch<T, S>(state);
|
||||
}
|
135
node_modules/rxjs/observable/GenerateObservable.js
generated
vendored
Normal file
135
node_modules/rxjs/observable/GenerateObservable.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var isScheduler_1 = require('../util/isScheduler');
|
||||
var selfSelector = function (value) { return value; };
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var GenerateObservable = (function (_super) {
|
||||
__extends(GenerateObservable, _super);
|
||||
function GenerateObservable(initialState, condition, iterate, resultSelector, scheduler) {
|
||||
_super.call(this);
|
||||
this.initialState = initialState;
|
||||
this.condition = condition;
|
||||
this.iterate = iterate;
|
||||
this.resultSelector = resultSelector;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
GenerateObservable.create = function (initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) {
|
||||
if (arguments.length == 1) {
|
||||
return new GenerateObservable(initialStateOrOptions.initialState, initialStateOrOptions.condition, initialStateOrOptions.iterate, initialStateOrOptions.resultSelector || selfSelector, initialStateOrOptions.scheduler);
|
||||
}
|
||||
if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) {
|
||||
return new GenerateObservable(initialStateOrOptions, condition, iterate, selfSelector, resultSelectorOrObservable);
|
||||
}
|
||||
return new GenerateObservable(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler);
|
||||
};
|
||||
/** @deprecated internal use only */ GenerateObservable.prototype._subscribe = function (subscriber) {
|
||||
var state = this.initialState;
|
||||
if (this.scheduler) {
|
||||
return this.scheduler.schedule(GenerateObservable.dispatch, 0, {
|
||||
subscriber: subscriber,
|
||||
iterate: this.iterate,
|
||||
condition: this.condition,
|
||||
resultSelector: this.resultSelector,
|
||||
state: state });
|
||||
}
|
||||
var _a = this, condition = _a.condition, resultSelector = _a.resultSelector, iterate = _a.iterate;
|
||||
do {
|
||||
if (condition) {
|
||||
var conditionResult = void 0;
|
||||
try {
|
||||
conditionResult = condition(state);
|
||||
}
|
||||
catch (err) {
|
||||
subscriber.error(err);
|
||||
return;
|
||||
}
|
||||
if (!conditionResult) {
|
||||
subscriber.complete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
var value = void 0;
|
||||
try {
|
||||
value = resultSelector(state);
|
||||
}
|
||||
catch (err) {
|
||||
subscriber.error(err);
|
||||
return;
|
||||
}
|
||||
subscriber.next(value);
|
||||
if (subscriber.closed) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
state = iterate(state);
|
||||
}
|
||||
catch (err) {
|
||||
subscriber.error(err);
|
||||
return;
|
||||
}
|
||||
} while (true);
|
||||
};
|
||||
GenerateObservable.dispatch = function (state) {
|
||||
var subscriber = state.subscriber, condition = state.condition;
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
if (state.needIterate) {
|
||||
try {
|
||||
state.state = state.iterate(state.state);
|
||||
}
|
||||
catch (err) {
|
||||
subscriber.error(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
state.needIterate = true;
|
||||
}
|
||||
if (condition) {
|
||||
var conditionResult = void 0;
|
||||
try {
|
||||
conditionResult = condition(state.state);
|
||||
}
|
||||
catch (err) {
|
||||
subscriber.error(err);
|
||||
return;
|
||||
}
|
||||
if (!conditionResult) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var value;
|
||||
try {
|
||||
value = state.resultSelector(state.state);
|
||||
}
|
||||
catch (err) {
|
||||
subscriber.error(err);
|
||||
return;
|
||||
}
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
subscriber.next(value);
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
return this.schedule(state);
|
||||
};
|
||||
return GenerateObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.GenerateObservable = GenerateObservable;
|
||||
//# sourceMappingURL=GenerateObservable.js.map
|
1
node_modules/rxjs/observable/GenerateObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/GenerateObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/rxjs/observable/IfObservable.d.ts
generated
vendored
Normal file
16
node_modules/rxjs/observable/IfObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Observable, SubscribableOrPromise } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class IfObservable<T, R> extends Observable<T> {
|
||||
private condition;
|
||||
private thenSource;
|
||||
private elseSource;
|
||||
static create<T, R>(condition: () => boolean | void, thenSource?: SubscribableOrPromise<T> | void, elseSource?: SubscribableOrPromise<R> | void): Observable<T | R>;
|
||||
constructor(condition: () => boolean | void, thenSource?: SubscribableOrPromise<T> | void, elseSource?: SubscribableOrPromise<R> | void);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T | R>): TeardownLogic;
|
||||
}
|
61
node_modules/rxjs/observable/IfObservable.js
generated
vendored
Normal file
61
node_modules/rxjs/observable/IfObservable.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var IfObservable = (function (_super) {
|
||||
__extends(IfObservable, _super);
|
||||
function IfObservable(condition, thenSource, elseSource) {
|
||||
_super.call(this);
|
||||
this.condition = condition;
|
||||
this.thenSource = thenSource;
|
||||
this.elseSource = elseSource;
|
||||
}
|
||||
IfObservable.create = function (condition, thenSource, elseSource) {
|
||||
return new IfObservable(condition, thenSource, elseSource);
|
||||
};
|
||||
/** @deprecated internal use only */ IfObservable.prototype._subscribe = function (subscriber) {
|
||||
var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource;
|
||||
return new IfSubscriber(subscriber, condition, thenSource, elseSource);
|
||||
};
|
||||
return IfObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.IfObservable = IfObservable;
|
||||
var IfSubscriber = (function (_super) {
|
||||
__extends(IfSubscriber, _super);
|
||||
function IfSubscriber(destination, condition, thenSource, elseSource) {
|
||||
_super.call(this, destination);
|
||||
this.condition = condition;
|
||||
this.thenSource = thenSource;
|
||||
this.elseSource = elseSource;
|
||||
this.tryIf();
|
||||
}
|
||||
IfSubscriber.prototype.tryIf = function () {
|
||||
var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource;
|
||||
var result;
|
||||
try {
|
||||
result = condition();
|
||||
var source = result ? thenSource : elseSource;
|
||||
if (source) {
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, source));
|
||||
}
|
||||
else {
|
||||
this._complete();
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this._error(err);
|
||||
}
|
||||
};
|
||||
return IfSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=IfObservable.js.map
|
1
node_modules/rxjs/observable/IfObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/IfObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IfObservable.js","sourceRoot":"","sources":["../../src/observable/IfObservable.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAkD,eAAe,CAAC,CAAA;AAIlE,kCAAkC,2BAA2B,CAAC,CAAA;AAC9D,gCAAgC,oBAAoB,CAAC,CAAA;AACrD;;;;GAIG;AACH;IAAwC,gCAAa;IAQnD,sBAAoB,SAA+B,EAC/B,UAA4C,EAC5C,UAA4C;QAC9D,iBAAO,CAAC;QAHU,cAAS,GAAT,SAAS,CAAsB;QAC/B,eAAU,GAAV,UAAU,CAAkC;QAC5C,eAAU,GAAV,UAAU,CAAkC;IAEhE,CAAC;IAVM,mBAAM,GAAb,UAAoB,SAA+B,EAC/B,UAA4C,EAC5C,UAA4C;QAC9D,MAAM,CAAC,IAAI,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7D,CAAC;IAQD,oCAAoC,CAAC,iCAAU,GAAV,UAAW,UAA2B;QACzE,IAAA,SAAkD,EAA1C,wBAAS,EAAE,0BAAU,EAAE,0BAAU,CAAU;QAEnD,MAAM,CAAC,IAAI,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC;IACH,mBAAC;AAAD,CAAC,AAnBD,CAAwC,uBAAU,GAmBjD;AAnBY,oBAAY,eAmBxB,CAAA;AAED;IAAiC,gCAAqB;IACpD,sBAAY,WAA0B,EAClB,SAA+B,EAC/B,UAA4C,EAC5C,UAA4C;QAC9D,kBAAM,WAAW,CAAC,CAAC;QAHD,cAAS,GAAT,SAAS,CAAsB;QAC/B,eAAU,GAAV,UAAU,CAAkC;QAC5C,eAAU,GAAV,UAAU,CAAkC;QAE9D,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAEO,4BAAK,GAAb;QACE,IAAA,SAAkD,EAA1C,wBAAS,EAAE,0BAAU,EAAE,0BAAU,CAAU;QAEnD,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAY,SAAS,EAAE,CAAC;YAC9B,IAAM,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;YAEhD,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,GAAG,CAAC,qCAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YAC5C,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,CAAC;QACH,CAAE;QAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AA1BD,CAAiC,iCAAe,GA0B/C","sourcesContent":["import { Observable, SubscribableOrPromise } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { TeardownLogic } from '../Subscription';\n\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class IfObservable<T, R> extends Observable<T> {\n\n static create<T, R>(condition: () => boolean | void,\n thenSource?: SubscribableOrPromise<T> | void,\n elseSource?: SubscribableOrPromise<R> | void): Observable<T|R> {\n return new IfObservable(condition, thenSource, elseSource);\n }\n\n constructor(private condition: () => boolean | void,\n private thenSource?: SubscribableOrPromise<T> | void,\n private elseSource?: SubscribableOrPromise<R> | void) {\n super();\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T|R>): TeardownLogic {\n const { condition, thenSource, elseSource } = this;\n\n return new IfSubscriber(subscriber, condition, thenSource, elseSource);\n }\n}\n\nclass IfSubscriber<T, R> extends OuterSubscriber<T, T> {\n constructor(destination: Subscriber<T>,\n private condition: () => boolean | void,\n private thenSource?: SubscribableOrPromise<T> | void,\n private elseSource?: SubscribableOrPromise<R> | void) {\n super(destination);\n this.tryIf();\n }\n\n private tryIf(): void {\n const { condition, thenSource, elseSource } = this;\n\n let result: boolean;\n try {\n result = <boolean>condition();\n const source = result ? thenSource : elseSource;\n\n if (source) {\n this.add(subscribeToResult(this, source));\n } else {\n this._complete();\n }\n } catch (err) {\n this._error(err);\n }\n }\n}\n"]}
|
49
node_modules/rxjs/observable/IntervalObservable.d.ts
generated
vendored
Normal file
49
node_modules/rxjs/observable/IntervalObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class IntervalObservable extends Observable<number> {
|
||||
private period;
|
||||
private scheduler;
|
||||
/**
|
||||
* Creates an Observable that emits sequential numbers every specified
|
||||
* interval of time, on a specified IScheduler.
|
||||
*
|
||||
* <span class="informal">Emits incremental numbers periodically in time.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/interval.png" width="100%">
|
||||
*
|
||||
* `interval` returns an Observable that emits an infinite sequence of
|
||||
* ascending integers, with a constant interval of time of your choosing
|
||||
* between those emissions. The first emission is not sent immediately, but
|
||||
* only after the first period has passed. By default, this operator uses the
|
||||
* `async` IScheduler to provide a notion of time, but you may pass any
|
||||
* IScheduler to it.
|
||||
*
|
||||
* @example <caption>Emits ascending numbers, one every second (1000ms)</caption>
|
||||
* var numbers = Rx.Observable.interval(1000);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link timer}
|
||||
* @see {@link delay}
|
||||
*
|
||||
* @param {number} [period=0] The interval size in milliseconds (by default)
|
||||
* or the time unit determined by the scheduler's clock.
|
||||
* @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling
|
||||
* the emission of values, and providing a notion of "time".
|
||||
* @return {Observable} An Observable that emits a sequential number each time
|
||||
* interval.
|
||||
* @static true
|
||||
* @name interval
|
||||
* @owner Observable
|
||||
*/
|
||||
static create(period?: number, scheduler?: IScheduler): Observable<number>;
|
||||
static dispatch(state: any): void;
|
||||
constructor(period?: number, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<number>): void;
|
||||
}
|
88
node_modules/rxjs/observable/IntervalObservable.js
generated
vendored
Normal file
88
node_modules/rxjs/observable/IntervalObservable.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var isNumeric_1 = require('../util/isNumeric');
|
||||
var Observable_1 = require('../Observable');
|
||||
var async_1 = require('../scheduler/async');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var IntervalObservable = (function (_super) {
|
||||
__extends(IntervalObservable, _super);
|
||||
function IntervalObservable(period, scheduler) {
|
||||
if (period === void 0) { period = 0; }
|
||||
if (scheduler === void 0) { scheduler = async_1.async; }
|
||||
_super.call(this);
|
||||
this.period = period;
|
||||
this.scheduler = scheduler;
|
||||
if (!isNumeric_1.isNumeric(period) || period < 0) {
|
||||
this.period = 0;
|
||||
}
|
||||
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
||||
this.scheduler = async_1.async;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates an Observable that emits sequential numbers every specified
|
||||
* interval of time, on a specified IScheduler.
|
||||
*
|
||||
* <span class="informal">Emits incremental numbers periodically in time.
|
||||
* </span>
|
||||
*
|
||||
* <img src="./img/interval.png" width="100%">
|
||||
*
|
||||
* `interval` returns an Observable that emits an infinite sequence of
|
||||
* ascending integers, with a constant interval of time of your choosing
|
||||
* between those emissions. The first emission is not sent immediately, but
|
||||
* only after the first period has passed. By default, this operator uses the
|
||||
* `async` IScheduler to provide a notion of time, but you may pass any
|
||||
* IScheduler to it.
|
||||
*
|
||||
* @example <caption>Emits ascending numbers, one every second (1000ms)</caption>
|
||||
* var numbers = Rx.Observable.interval(1000);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link timer}
|
||||
* @see {@link delay}
|
||||
*
|
||||
* @param {number} [period=0] The interval size in milliseconds (by default)
|
||||
* or the time unit determined by the scheduler's clock.
|
||||
* @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling
|
||||
* the emission of values, and providing a notion of "time".
|
||||
* @return {Observable} An Observable that emits a sequential number each time
|
||||
* interval.
|
||||
* @static true
|
||||
* @name interval
|
||||
* @owner Observable
|
||||
*/
|
||||
IntervalObservable.create = function (period, scheduler) {
|
||||
if (period === void 0) { period = 0; }
|
||||
if (scheduler === void 0) { scheduler = async_1.async; }
|
||||
return new IntervalObservable(period, scheduler);
|
||||
};
|
||||
IntervalObservable.dispatch = function (state) {
|
||||
var index = state.index, subscriber = state.subscriber, period = state.period;
|
||||
subscriber.next(index);
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
state.index += 1;
|
||||
this.schedule(state, period);
|
||||
};
|
||||
/** @deprecated internal use only */ IntervalObservable.prototype._subscribe = function (subscriber) {
|
||||
var index = 0;
|
||||
var period = this.period;
|
||||
var scheduler = this.scheduler;
|
||||
subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, {
|
||||
index: index, subscriber: subscriber, period: period
|
||||
}));
|
||||
};
|
||||
return IntervalObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.IntervalObservable = IntervalObservable;
|
||||
//# sourceMappingURL=IntervalObservable.js.map
|
1
node_modules/rxjs/observable/IntervalObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/IntervalObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IntervalObservable.js","sourceRoot":"","sources":["../../src/observable/IntervalObservable.ts"],"names":[],"mappings":";;;;;;AACA,0BAA0B,mBAAmB,CAAC,CAAA;AAE9C,2BAA2B,eAAe,CAAC,CAAA;AAC3C,sBAAsB,oBAAoB,CAAC,CAAA;AAE3C;;;;GAIG;AACH;IAAwC,sCAAkB;IAqDxD,4BAAoB,MAAkB,EAClB,SAA6B;QADrC,sBAA0B,GAA1B,UAA0B;QAC1B,yBAAqC,GAArC,yBAAqC;QAC/C,iBAAO,CAAC;QAFU,WAAM,GAAN,MAAM,CAAY;QAClB,cAAS,GAAT,SAAS,CAAoB;QAE/C,EAAE,CAAC,CAAC,CAAC,qBAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YACrC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAClB,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC;YAC3D,IAAI,CAAC,SAAS,GAAG,aAAK,CAAC;QACzB,CAAC;IACH,CAAC;IA7DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,yBAAM,GAAb,UAAc,MAAkB,EAClB,SAA6B;QAD7B,sBAAkB,GAAlB,UAAkB;QAClB,yBAA6B,GAA7B,yBAA6B;QACzC,MAAM,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAEM,2BAAQ,GAAf,UAAgB,KAAU;QAChB,uBAAK,EAAE,6BAAU,EAAE,qBAAM,CAAW;QAE5C,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEvB,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,MAAM,CAAC;QACT,CAAC;QAED,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;QAEV,IAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAaD,oCAAoC,CAAC,uCAAU,GAAV,UAAW,UAA8B;QAC5E,IAAM,KAAK,GAAG,CAAC,CAAC;QAChB,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE;YACrE,YAAK,EAAE,sBAAU,EAAE,cAAM;SAC1B,CAAC,CAAC,CAAC;IACN,CAAC;IACH,yBAAC;AAAD,CAAC,AAzED,CAAwC,uBAAU,GAyEjD;AAzEY,0BAAkB,qBAyE9B,CAAA","sourcesContent":["import { Subscriber } from '../Subscriber';\nimport { isNumeric } from '../util/isNumeric';\nimport { IScheduler } from '../Scheduler';\nimport { Observable } from '../Observable';\nimport { async } from '../scheduler/async';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class IntervalObservable extends Observable<number> {\n /**\n * Creates an Observable that emits sequential numbers every specified\n * interval of time, on a specified IScheduler.\n *\n * <span class=\"informal\">Emits incremental numbers periodically in time.\n * </span>\n *\n * <img src=\"./img/interval.png\" width=\"100%\">\n *\n * `interval` returns an Observable that emits an infinite sequence of\n * ascending integers, with a constant interval of time of your choosing\n * between those emissions. The first emission is not sent immediately, but\n * only after the first period has passed. By default, this operator uses the\n * `async` IScheduler to provide a notion of time, but you may pass any\n * IScheduler to it.\n *\n * @example <caption>Emits ascending numbers, one every second (1000ms)</caption>\n * var numbers = Rx.Observable.interval(1000);\n * numbers.subscribe(x => console.log(x));\n *\n * @see {@link timer}\n * @see {@link delay}\n *\n * @param {number} [period=0] The interval size in milliseconds (by default)\n * or the time unit determined by the scheduler's clock.\n * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling\n * the emission of values, and providing a notion of \"time\".\n * @return {Observable} An Observable that emits a sequential number each time\n * interval.\n * @static true\n * @name interval\n * @owner Observable\n */\n static create(period: number = 0,\n scheduler: IScheduler = async): Observable<number> {\n return new IntervalObservable(period, scheduler);\n }\n\n static dispatch(state: any): void {\n const { index, subscriber, period } = state;\n\n subscriber.next(index);\n\n if (subscriber.closed) {\n return;\n }\n\n state.index += 1;\n\n (<any> this).schedule(state, period);\n }\n\n constructor(private period: number = 0,\n private scheduler: IScheduler = async) {\n super();\n if (!isNumeric(period) || period < 0) {\n this.period = 0;\n }\n if (!scheduler || typeof scheduler.schedule !== 'function') {\n this.scheduler = async;\n }\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<number>) {\n const index = 0;\n const period = this.period;\n const scheduler = this.scheduler;\n\n subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, {\n index, subscriber, period\n }));\n }\n}\n"]}
|
17
node_modules/rxjs/observable/IteratorObservable.d.ts
generated
vendored
Normal file
17
node_modules/rxjs/observable/IteratorObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class IteratorObservable<T> extends Observable<T> {
|
||||
private scheduler;
|
||||
private iterator;
|
||||
static create<T>(iterator: any, scheduler?: IScheduler): IteratorObservable<T>;
|
||||
static dispatch(state: any): void;
|
||||
constructor(iterator: any, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
163
node_modules/rxjs/observable/IteratorObservable.js
generated
vendored
Normal file
163
node_modules/rxjs/observable/IteratorObservable.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var root_1 = require('../util/root');
|
||||
var Observable_1 = require('../Observable');
|
||||
var iterator_1 = require('../symbol/iterator');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var IteratorObservable = (function (_super) {
|
||||
__extends(IteratorObservable, _super);
|
||||
function IteratorObservable(iterator, scheduler) {
|
||||
_super.call(this);
|
||||
this.scheduler = scheduler;
|
||||
if (iterator == null) {
|
||||
throw new Error('iterator cannot be null.');
|
||||
}
|
||||
this.iterator = getIterator(iterator);
|
||||
}
|
||||
IteratorObservable.create = function (iterator, scheduler) {
|
||||
return new IteratorObservable(iterator, scheduler);
|
||||
};
|
||||
IteratorObservable.dispatch = function (state) {
|
||||
var index = state.index, hasError = state.hasError, iterator = state.iterator, subscriber = state.subscriber;
|
||||
if (hasError) {
|
||||
subscriber.error(state.error);
|
||||
return;
|
||||
}
|
||||
var result = iterator.next();
|
||||
if (result.done) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
subscriber.next(result.value);
|
||||
state.index = index + 1;
|
||||
if (subscriber.closed) {
|
||||
if (typeof iterator.return === 'function') {
|
||||
iterator.return();
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.schedule(state);
|
||||
};
|
||||
/** @deprecated internal use only */ IteratorObservable.prototype._subscribe = function (subscriber) {
|
||||
var index = 0;
|
||||
var _a = this, iterator = _a.iterator, scheduler = _a.scheduler;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(IteratorObservable.dispatch, 0, {
|
||||
index: index, iterator: iterator, subscriber: subscriber
|
||||
});
|
||||
}
|
||||
else {
|
||||
do {
|
||||
var result = iterator.next();
|
||||
if (result.done) {
|
||||
subscriber.complete();
|
||||
break;
|
||||
}
|
||||
else {
|
||||
subscriber.next(result.value);
|
||||
}
|
||||
if (subscriber.closed) {
|
||||
if (typeof iterator.return === 'function') {
|
||||
iterator.return();
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
};
|
||||
return IteratorObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.IteratorObservable = IteratorObservable;
|
||||
var StringIterator = (function () {
|
||||
function StringIterator(str, idx, len) {
|
||||
if (idx === void 0) { idx = 0; }
|
||||
if (len === void 0) { len = str.length; }
|
||||
this.str = str;
|
||||
this.idx = idx;
|
||||
this.len = len;
|
||||
}
|
||||
StringIterator.prototype[iterator_1.iterator] = function () { return (this); };
|
||||
StringIterator.prototype.next = function () {
|
||||
return this.idx < this.len ? {
|
||||
done: false,
|
||||
value: this.str.charAt(this.idx++)
|
||||
} : {
|
||||
done: true,
|
||||
value: undefined
|
||||
};
|
||||
};
|
||||
return StringIterator;
|
||||
}());
|
||||
var ArrayIterator = (function () {
|
||||
function ArrayIterator(arr, idx, len) {
|
||||
if (idx === void 0) { idx = 0; }
|
||||
if (len === void 0) { len = toLength(arr); }
|
||||
this.arr = arr;
|
||||
this.idx = idx;
|
||||
this.len = len;
|
||||
}
|
||||
ArrayIterator.prototype[iterator_1.iterator] = function () { return this; };
|
||||
ArrayIterator.prototype.next = function () {
|
||||
return this.idx < this.len ? {
|
||||
done: false,
|
||||
value: this.arr[this.idx++]
|
||||
} : {
|
||||
done: true,
|
||||
value: undefined
|
||||
};
|
||||
};
|
||||
return ArrayIterator;
|
||||
}());
|
||||
function getIterator(obj) {
|
||||
var i = obj[iterator_1.iterator];
|
||||
if (!i && typeof obj === 'string') {
|
||||
return new StringIterator(obj);
|
||||
}
|
||||
if (!i && obj.length !== undefined) {
|
||||
return new ArrayIterator(obj);
|
||||
}
|
||||
if (!i) {
|
||||
throw new TypeError('object is not iterable');
|
||||
}
|
||||
return obj[iterator_1.iterator]();
|
||||
}
|
||||
var maxSafeInteger = Math.pow(2, 53) - 1;
|
||||
function toLength(o) {
|
||||
var len = +o.length;
|
||||
if (isNaN(len)) {
|
||||
return 0;
|
||||
}
|
||||
if (len === 0 || !numberIsFinite(len)) {
|
||||
return len;
|
||||
}
|
||||
len = sign(len) * Math.floor(Math.abs(len));
|
||||
if (len <= 0) {
|
||||
return 0;
|
||||
}
|
||||
if (len > maxSafeInteger) {
|
||||
return maxSafeInteger;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
function numberIsFinite(value) {
|
||||
return typeof value === 'number' && root_1.root.isFinite(value);
|
||||
}
|
||||
function sign(value) {
|
||||
var valueAsNumber = +value;
|
||||
if (valueAsNumber === 0) {
|
||||
return valueAsNumber;
|
||||
}
|
||||
if (isNaN(valueAsNumber)) {
|
||||
return valueAsNumber;
|
||||
}
|
||||
return valueAsNumber < 0 ? -1 : 1;
|
||||
}
|
||||
//# sourceMappingURL=IteratorObservable.js.map
|
1
node_modules/rxjs/observable/IteratorObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/IteratorObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
43
node_modules/rxjs/observable/NeverObservable.d.ts
generated
vendored
Normal file
43
node_modules/rxjs/observable/NeverObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class NeverObservable<T> extends Observable<T> {
|
||||
/**
|
||||
* Creates an Observable that emits no items to the Observer.
|
||||
*
|
||||
* <span class="informal">An Observable that never emits anything.</span>
|
||||
*
|
||||
* <img src="./img/never.png" width="100%">
|
||||
*
|
||||
* This static operator is useful for creating a simple Observable that emits
|
||||
* neither values nor errors nor the completion notification. It can be used
|
||||
* for testing purposes or for composing with other Observables. Please note
|
||||
* that by never emitting a complete notification, this Observable keeps the
|
||||
* subscription from being disposed automatically. Subscriptions need to be
|
||||
* manually disposed.
|
||||
*
|
||||
* @example <caption>Emit the number 7, then never emit anything else (not even complete).</caption>
|
||||
* function info() {
|
||||
* console.log('Will not be called');
|
||||
* }
|
||||
* var result = Rx.Observable.never().startWith(7);
|
||||
* result.subscribe(x => console.log(x), info, info);
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link empty}
|
||||
* @see {@link of}
|
||||
* @see {@link throw}
|
||||
*
|
||||
* @return {Observable} A "never" Observable: never emits anything.
|
||||
* @static true
|
||||
* @name never
|
||||
* @owner Observable
|
||||
*/
|
||||
static create<T>(): NeverObservable<T>;
|
||||
constructor();
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): void;
|
||||
}
|
59
node_modules/rxjs/observable/NeverObservable.js
generated
vendored
Normal file
59
node_modules/rxjs/observable/NeverObservable.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var noop_1 = require('../util/noop');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var NeverObservable = (function (_super) {
|
||||
__extends(NeverObservable, _super);
|
||||
function NeverObservable() {
|
||||
_super.call(this);
|
||||
}
|
||||
/**
|
||||
* Creates an Observable that emits no items to the Observer.
|
||||
*
|
||||
* <span class="informal">An Observable that never emits anything.</span>
|
||||
*
|
||||
* <img src="./img/never.png" width="100%">
|
||||
*
|
||||
* This static operator is useful for creating a simple Observable that emits
|
||||
* neither values nor errors nor the completion notification. It can be used
|
||||
* for testing purposes or for composing with other Observables. Please note
|
||||
* that by never emitting a complete notification, this Observable keeps the
|
||||
* subscription from being disposed automatically. Subscriptions need to be
|
||||
* manually disposed.
|
||||
*
|
||||
* @example <caption>Emit the number 7, then never emit anything else (not even complete).</caption>
|
||||
* function info() {
|
||||
* console.log('Will not be called');
|
||||
* }
|
||||
* var result = Rx.Observable.never().startWith(7);
|
||||
* result.subscribe(x => console.log(x), info, info);
|
||||
*
|
||||
* @see {@link create}
|
||||
* @see {@link empty}
|
||||
* @see {@link of}
|
||||
* @see {@link throw}
|
||||
*
|
||||
* @return {Observable} A "never" Observable: never emits anything.
|
||||
* @static true
|
||||
* @name never
|
||||
* @owner Observable
|
||||
*/
|
||||
NeverObservable.create = function () {
|
||||
return new NeverObservable();
|
||||
};
|
||||
/** @deprecated internal use only */ NeverObservable.prototype._subscribe = function (subscriber) {
|
||||
noop_1.noop();
|
||||
};
|
||||
return NeverObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.NeverObservable = NeverObservable;
|
||||
//# sourceMappingURL=NeverObservable.js.map
|
1
node_modules/rxjs/observable/NeverObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/NeverObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NeverObservable.js","sourceRoot":"","sources":["../../src/observable/NeverObservable.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA2B,eAAe,CAAC,CAAA;AAE3C,qBAAqB,cAAc,CAAC,CAAA;AAEpC;;;;GAIG;AACH;IAAwC,mCAAa;IAoCnD;QACE,iBAAO,CAAC;IACV,CAAC;IArCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACI,sBAAM,GAAb;QACE,MAAM,CAAC,IAAI,eAAe,EAAK,CAAC;IAClC,CAAC;IAMD,oCAAoC,CAAC,oCAAU,GAAV,UAAW,UAAyB;QACvE,WAAI,EAAE,CAAC;IACT,CAAC;IACH,sBAAC;AAAD,CAAC,AA3CD,CAAwC,uBAAU,GA2CjD;AA3CY,uBAAe,kBA2C3B,CAAA","sourcesContent":["import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { noop } from '../util/noop';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class NeverObservable<T> extends Observable<T> {\n /**\n * Creates an Observable that emits no items to the Observer.\n *\n * <span class=\"informal\">An Observable that never emits anything.</span>\n *\n * <img src=\"./img/never.png\" width=\"100%\">\n *\n * This static operator is useful for creating a simple Observable that emits\n * neither values nor errors nor the completion notification. It can be used\n * for testing purposes or for composing with other Observables. Please note\n * that by never emitting a complete notification, this Observable keeps the\n * subscription from being disposed automatically. Subscriptions need to be\n * manually disposed.\n *\n * @example <caption>Emit the number 7, then never emit anything else (not even complete).</caption>\n * function info() {\n * console.log('Will not be called');\n * }\n * var result = Rx.Observable.never().startWith(7);\n * result.subscribe(x => console.log(x), info, info);\n *\n * @see {@link create}\n * @see {@link empty}\n * @see {@link of}\n * @see {@link throw}\n *\n * @return {Observable} A \"never\" Observable: never emits anything.\n * @static true\n * @name never\n * @owner Observable\n */\n static create<T>() {\n return new NeverObservable<T>();\n }\n\n constructor() {\n super();\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): void {\n noop();\n }\n}\n"]}
|
48
node_modules/rxjs/observable/PairsObservable.d.ts
generated
vendored
Normal file
48
node_modules/rxjs/observable/PairsObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class PairsObservable<T> extends Observable<Array<string | T>> {
|
||||
private obj;
|
||||
private scheduler;
|
||||
private keys;
|
||||
/**
|
||||
* Convert an object into an observable sequence of [key, value] pairs
|
||||
* using an optional IScheduler to enumerate the object.
|
||||
*
|
||||
* @example <caption>Converts a javascript object to an Observable</caption>
|
||||
* var obj = {
|
||||
* foo: 42,
|
||||
* bar: 56,
|
||||
* baz: 78
|
||||
* };
|
||||
*
|
||||
* var source = Rx.Observable.pairs(obj);
|
||||
*
|
||||
* var subscription = source.subscribe(
|
||||
* function (x) {
|
||||
* console.log('Next: %s', x);
|
||||
* },
|
||||
* function (err) {
|
||||
* console.log('Error: %s', err);
|
||||
* },
|
||||
* function () {
|
||||
* console.log('Completed');
|
||||
* });
|
||||
*
|
||||
* @param {Object} obj The object to inspect and turn into an
|
||||
* Observable sequence.
|
||||
* @param {Scheduler} [scheduler] An optional IScheduler to run the
|
||||
* enumeration of the input sequence on.
|
||||
* @returns {(Observable<Array<string | T>>)} An observable sequence of
|
||||
* [key, value] pairs from the object.
|
||||
*/
|
||||
static create<T>(obj: Object, scheduler?: IScheduler): Observable<Array<string | T>>;
|
||||
constructor(obj: Object, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<Array<string | T>>): TeardownLogic;
|
||||
}
|
85
node_modules/rxjs/observable/PairsObservable.js
generated
vendored
Normal file
85
node_modules/rxjs/observable/PairsObservable.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
function dispatch(state) {
|
||||
var obj = state.obj, keys = state.keys, length = state.length, index = state.index, subscriber = state.subscriber;
|
||||
if (index === length) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
var key = keys[index];
|
||||
subscriber.next([key, obj[key]]);
|
||||
state.index = index + 1;
|
||||
this.schedule(state);
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var PairsObservable = (function (_super) {
|
||||
__extends(PairsObservable, _super);
|
||||
function PairsObservable(obj, scheduler) {
|
||||
_super.call(this);
|
||||
this.obj = obj;
|
||||
this.scheduler = scheduler;
|
||||
this.keys = Object.keys(obj);
|
||||
}
|
||||
/**
|
||||
* Convert an object into an observable sequence of [key, value] pairs
|
||||
* using an optional IScheduler to enumerate the object.
|
||||
*
|
||||
* @example <caption>Converts a javascript object to an Observable</caption>
|
||||
* var obj = {
|
||||
* foo: 42,
|
||||
* bar: 56,
|
||||
* baz: 78
|
||||
* };
|
||||
*
|
||||
* var source = Rx.Observable.pairs(obj);
|
||||
*
|
||||
* var subscription = source.subscribe(
|
||||
* function (x) {
|
||||
* console.log('Next: %s', x);
|
||||
* },
|
||||
* function (err) {
|
||||
* console.log('Error: %s', err);
|
||||
* },
|
||||
* function () {
|
||||
* console.log('Completed');
|
||||
* });
|
||||
*
|
||||
* @param {Object} obj The object to inspect and turn into an
|
||||
* Observable sequence.
|
||||
* @param {Scheduler} [scheduler] An optional IScheduler to run the
|
||||
* enumeration of the input sequence on.
|
||||
* @returns {(Observable<Array<string | T>>)} An observable sequence of
|
||||
* [key, value] pairs from the object.
|
||||
*/
|
||||
PairsObservable.create = function (obj, scheduler) {
|
||||
return new PairsObservable(obj, scheduler);
|
||||
};
|
||||
/** @deprecated internal use only */ PairsObservable.prototype._subscribe = function (subscriber) {
|
||||
var _a = this, keys = _a.keys, scheduler = _a.scheduler;
|
||||
var length = keys.length;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(dispatch, 0, {
|
||||
obj: this.obj, keys: keys, length: length, index: 0, subscriber: subscriber
|
||||
});
|
||||
}
|
||||
else {
|
||||
for (var idx = 0; idx < length; idx++) {
|
||||
var key = keys[idx];
|
||||
subscriber.next([key, this.obj[key]]);
|
||||
}
|
||||
subscriber.complete();
|
||||
}
|
||||
};
|
||||
return PairsObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.PairsObservable = PairsObservable;
|
||||
//# sourceMappingURL=PairsObservable.js.map
|
1
node_modules/rxjs/observable/PairsObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/PairsObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PairsObservable.js","sourceRoot":"","sources":["../../src/observable/PairsObservable.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAY3C,kBAAoD,KAAsB;IACjE,mBAAG,EAAE,iBAAI,EAAE,qBAAM,EAAE,mBAAK,EAAE,6BAAU,CAAU;IAErD,EAAE,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC;QACrB,UAAU,CAAC,QAAQ,EAAE,CAAC;QACtB,MAAM,CAAC;IACT,CAAC;IAED,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEjC,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;IAExB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH;IAAwC,mCAA6B;IAsCnE,yBAAoB,GAAW,EAAU,SAAsB;QAC7D,iBAAO,CAAC;QADU,QAAG,GAAH,GAAG,CAAQ;QAAU,cAAS,GAAT,SAAS,CAAa;QAE7D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAtCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACI,sBAAM,GAAb,UAAiB,GAAW,EAAE,SAAsB;QAClD,MAAM,CAAC,IAAI,eAAe,CAAI,GAAG,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAOD,oCAAoC,CAAC,oCAAU,GAAV,UAAW,UAAyC;QACvF,IAAA,SAA8B,EAAvB,cAAI,EAAE,wBAAS,CAAS;QAC/B,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE3B,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACrC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,UAAI,EAAE,cAAM,EAAE,KAAK,EAAE,CAAC,EAAE,sBAAU;aAClD,CAAC,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,GAAG,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;gBACtC,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;gBACtB,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACxC,CAAC;YACD,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AA3DD,CAAwC,uBAAU,GA2DjD;AA3DY,uBAAe,kBA2D3B,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\r\nimport { Action } from '../scheduler/Action';\r\nimport { Observable } from '../Observable';\r\nimport { Subscriber } from '../Subscriber';\r\nimport { TeardownLogic } from '../Subscription';\r\n\r\ninterface PairsContext<T> {\r\n obj: Object;\r\n keys: Array<string>;\r\n length: number;\r\n index: number;\r\n subscriber: Subscriber<Array<string | T>>;\r\n}\r\n\r\nfunction dispatch<T>(this: Action<PairsContext<T>>, state: PairsContext<T>) {\r\n const {obj, keys, length, index, subscriber} = state;\r\n\r\n if (index === length) {\r\n subscriber.complete();\r\n return;\r\n }\r\n\r\n const key = keys[index];\r\n subscriber.next([key, obj[key]]);\r\n\r\n state.index = index + 1;\r\n\r\n this.schedule(state);\r\n}\r\n\r\n/**\r\n * We need this JSDoc comment for affecting ESDoc.\r\n * @extends {Ignored}\r\n * @hide true\r\n */\r\nexport class PairsObservable<T> extends Observable<Array<string | T>> {\r\n private keys: Array<string>;\r\n\r\n /**\r\n * Convert an object into an observable sequence of [key, value] pairs\r\n * using an optional IScheduler to enumerate the object.\r\n *\r\n * @example <caption>Converts a javascript object to an Observable</caption>\r\n * var obj = {\r\n * foo: 42,\r\n * bar: 56,\r\n * baz: 78\r\n * };\r\n *\r\n * var source = Rx.Observable.pairs(obj);\r\n *\r\n * var subscription = source.subscribe(\r\n * function (x) {\r\n * console.log('Next: %s', x);\r\n * },\r\n * function (err) {\r\n * console.log('Error: %s', err);\r\n * },\r\n * function () {\r\n * console.log('Completed');\r\n * });\r\n *\r\n * @param {Object} obj The object to inspect and turn into an\r\n * Observable sequence.\r\n * @param {Scheduler} [scheduler] An optional IScheduler to run the\r\n * enumeration of the input sequence on.\r\n * @returns {(Observable<Array<string | T>>)} An observable sequence of\r\n * [key, value] pairs from the object.\r\n */\r\n static create<T>(obj: Object, scheduler?: IScheduler): Observable<Array<string | T>> {\r\n return new PairsObservable<T>(obj, scheduler);\r\n }\r\n\r\n constructor(private obj: Object, private scheduler?: IScheduler) {\r\n super();\r\n this.keys = Object.keys(obj);\r\n }\r\n\r\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<Array<string | T>>): TeardownLogic {\r\n const {keys, scheduler} = this;\r\n const length = keys.length;\r\n\r\n if (scheduler) {\r\n return scheduler.schedule(dispatch, 0, {\r\n obj: this.obj, keys, length, index: 0, subscriber\r\n });\r\n } else {\r\n for (let idx = 0; idx < length; idx++) {\r\n const key = keys[idx];\r\n subscriber.next([key, this.obj[key]]);\r\n }\r\n subscriber.complete();\r\n }\r\n }\r\n}\r\n"]}
|
43
node_modules/rxjs/observable/PromiseObservable.d.ts
generated
vendored
Normal file
43
node_modules/rxjs/observable/PromiseObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class PromiseObservable<T> extends Observable<T> {
|
||||
private promise;
|
||||
private scheduler;
|
||||
value: T;
|
||||
/**
|
||||
* Converts a Promise to an Observable.
|
||||
*
|
||||
* <span class="informal">Returns an Observable that just emits the Promise's
|
||||
* resolved value, then completes.</span>
|
||||
*
|
||||
* Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an
|
||||
* Observable. If the Promise resolves with a value, the output Observable
|
||||
* emits that resolved value as a `next`, and then completes. If the Promise
|
||||
* is rejected, then the output Observable emits the corresponding Error.
|
||||
*
|
||||
* @example <caption>Convert the Promise returned by Fetch to an Observable</caption>
|
||||
* var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* @see {@link bindCallback}
|
||||
* @see {@link from}
|
||||
*
|
||||
* @param {PromiseLike<T>} promise The promise to be converted.
|
||||
* @param {Scheduler} [scheduler] An optional IScheduler to use for scheduling
|
||||
* the delivery of the resolved value (or the rejection).
|
||||
* @return {Observable<T>} An Observable which wraps the Promise.
|
||||
* @static true
|
||||
* @name fromPromise
|
||||
* @owner Observable
|
||||
*/
|
||||
static create<T>(promise: PromiseLike<T>, scheduler?: IScheduler): Observable<T>;
|
||||
constructor(promise: PromiseLike<T>, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
121
node_modules/rxjs/observable/PromiseObservable.js
generated
vendored
Normal file
121
node_modules/rxjs/observable/PromiseObservable.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var root_1 = require('../util/root');
|
||||
var Observable_1 = require('../Observable');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var PromiseObservable = (function (_super) {
|
||||
__extends(PromiseObservable, _super);
|
||||
function PromiseObservable(promise, scheduler) {
|
||||
_super.call(this);
|
||||
this.promise = promise;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
/**
|
||||
* Converts a Promise to an Observable.
|
||||
*
|
||||
* <span class="informal">Returns an Observable that just emits the Promise's
|
||||
* resolved value, then completes.</span>
|
||||
*
|
||||
* Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an
|
||||
* Observable. If the Promise resolves with a value, the output Observable
|
||||
* emits that resolved value as a `next`, and then completes. If the Promise
|
||||
* is rejected, then the output Observable emits the corresponding Error.
|
||||
*
|
||||
* @example <caption>Convert the Promise returned by Fetch to an Observable</caption>
|
||||
* var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));
|
||||
* result.subscribe(x => console.log(x), e => console.error(e));
|
||||
*
|
||||
* @see {@link bindCallback}
|
||||
* @see {@link from}
|
||||
*
|
||||
* @param {PromiseLike<T>} promise The promise to be converted.
|
||||
* @param {Scheduler} [scheduler] An optional IScheduler to use for scheduling
|
||||
* the delivery of the resolved value (or the rejection).
|
||||
* @return {Observable<T>} An Observable which wraps the Promise.
|
||||
* @static true
|
||||
* @name fromPromise
|
||||
* @owner Observable
|
||||
*/
|
||||
PromiseObservable.create = function (promise, scheduler) {
|
||||
return new PromiseObservable(promise, scheduler);
|
||||
};
|
||||
/** @deprecated internal use only */ PromiseObservable.prototype._subscribe = function (subscriber) {
|
||||
var _this = this;
|
||||
var promise = this.promise;
|
||||
var scheduler = this.scheduler;
|
||||
if (scheduler == null) {
|
||||
if (this._isScalar) {
|
||||
if (!subscriber.closed) {
|
||||
subscriber.next(this.value);
|
||||
subscriber.complete();
|
||||
}
|
||||
}
|
||||
else {
|
||||
promise.then(function (value) {
|
||||
_this.value = value;
|
||||
_this._isScalar = true;
|
||||
if (!subscriber.closed) {
|
||||
subscriber.next(value);
|
||||
subscriber.complete();
|
||||
}
|
||||
}, function (err) {
|
||||
if (!subscriber.closed) {
|
||||
subscriber.error(err);
|
||||
}
|
||||
})
|
||||
.then(null, function (err) {
|
||||
// escape the promise trap, throw unhandled errors
|
||||
root_1.root.setTimeout(function () { throw err; });
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this._isScalar) {
|
||||
if (!subscriber.closed) {
|
||||
return scheduler.schedule(dispatchNext, 0, { value: this.value, subscriber: subscriber });
|
||||
}
|
||||
}
|
||||
else {
|
||||
promise.then(function (value) {
|
||||
_this.value = value;
|
||||
_this._isScalar = true;
|
||||
if (!subscriber.closed) {
|
||||
subscriber.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber }));
|
||||
}
|
||||
}, function (err) {
|
||||
if (!subscriber.closed) {
|
||||
subscriber.add(scheduler.schedule(dispatchError, 0, { err: err, subscriber: subscriber }));
|
||||
}
|
||||
})
|
||||
.then(null, function (err) {
|
||||
// escape the promise trap, throw unhandled errors
|
||||
root_1.root.setTimeout(function () { throw err; });
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return PromiseObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.PromiseObservable = PromiseObservable;
|
||||
function dispatchNext(arg) {
|
||||
var value = arg.value, subscriber = arg.subscriber;
|
||||
if (!subscriber.closed) {
|
||||
subscriber.next(value);
|
||||
subscriber.complete();
|
||||
}
|
||||
}
|
||||
function dispatchError(arg) {
|
||||
var err = arg.err, subscriber = arg.subscriber;
|
||||
if (!subscriber.closed) {
|
||||
subscriber.error(err);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=PromiseObservable.js.map
|
1
node_modules/rxjs/observable/PromiseObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/PromiseObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
48
node_modules/rxjs/observable/RangeObservable.d.ts
generated
vendored
Normal file
48
node_modules/rxjs/observable/RangeObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class RangeObservable extends Observable<number> {
|
||||
/**
|
||||
* Creates an Observable that emits a sequence of numbers within a specified
|
||||
* range.
|
||||
*
|
||||
* <span class="informal">Emits a sequence of numbers in a range.</span>
|
||||
*
|
||||
* <img src="./img/range.png" width="100%">
|
||||
*
|
||||
* `range` operator emits a range of sequential integers, in order, where you
|
||||
* select the `start` of the range and its `length`. By default, uses no
|
||||
* IScheduler and just delivers the notifications synchronously, but may use
|
||||
* an optional IScheduler to regulate those deliveries.
|
||||
*
|
||||
* @example <caption>Emits the numbers 1 to 10</caption>
|
||||
* var numbers = Rx.Observable.range(1, 10);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link timer}
|
||||
* @see {@link interval}
|
||||
*
|
||||
* @param {number} [start=0] The value of the first integer in the sequence.
|
||||
* @param {number} [count=0] The number of sequential integers to generate.
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
|
||||
* the emissions of the notifications.
|
||||
* @return {Observable} An Observable of numbers that emits a finite range of
|
||||
* sequential integers.
|
||||
* @static true
|
||||
* @name range
|
||||
* @owner Observable
|
||||
*/
|
||||
static create(start?: number, count?: number, scheduler?: IScheduler): Observable<number>;
|
||||
static dispatch(state: any): void;
|
||||
private start;
|
||||
private _count;
|
||||
private scheduler;
|
||||
constructor(start: number, count: number, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<number>): TeardownLogic;
|
||||
}
|
96
node_modules/rxjs/observable/RangeObservable.js
generated
vendored
Normal file
96
node_modules/rxjs/observable/RangeObservable.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var RangeObservable = (function (_super) {
|
||||
__extends(RangeObservable, _super);
|
||||
function RangeObservable(start, count, scheduler) {
|
||||
_super.call(this);
|
||||
this.start = start;
|
||||
this._count = count;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
/**
|
||||
* Creates an Observable that emits a sequence of numbers within a specified
|
||||
* range.
|
||||
*
|
||||
* <span class="informal">Emits a sequence of numbers in a range.</span>
|
||||
*
|
||||
* <img src="./img/range.png" width="100%">
|
||||
*
|
||||
* `range` operator emits a range of sequential integers, in order, where you
|
||||
* select the `start` of the range and its `length`. By default, uses no
|
||||
* IScheduler and just delivers the notifications synchronously, but may use
|
||||
* an optional IScheduler to regulate those deliveries.
|
||||
*
|
||||
* @example <caption>Emits the numbers 1 to 10</caption>
|
||||
* var numbers = Rx.Observable.range(1, 10);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link timer}
|
||||
* @see {@link interval}
|
||||
*
|
||||
* @param {number} [start=0] The value of the first integer in the sequence.
|
||||
* @param {number} [count=0] The number of sequential integers to generate.
|
||||
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
|
||||
* the emissions of the notifications.
|
||||
* @return {Observable} An Observable of numbers that emits a finite range of
|
||||
* sequential integers.
|
||||
* @static true
|
||||
* @name range
|
||||
* @owner Observable
|
||||
*/
|
||||
RangeObservable.create = function (start, count, scheduler) {
|
||||
if (start === void 0) { start = 0; }
|
||||
if (count === void 0) { count = 0; }
|
||||
return new RangeObservable(start, count, scheduler);
|
||||
};
|
||||
RangeObservable.dispatch = function (state) {
|
||||
var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber;
|
||||
if (index >= count) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
subscriber.next(start);
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
state.index = index + 1;
|
||||
state.start = start + 1;
|
||||
this.schedule(state);
|
||||
};
|
||||
/** @deprecated internal use only */ RangeObservable.prototype._subscribe = function (subscriber) {
|
||||
var index = 0;
|
||||
var start = this.start;
|
||||
var count = this._count;
|
||||
var scheduler = this.scheduler;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(RangeObservable.dispatch, 0, {
|
||||
index: index, count: count, start: start, subscriber: subscriber
|
||||
});
|
||||
}
|
||||
else {
|
||||
do {
|
||||
if (index++ >= count) {
|
||||
subscriber.complete();
|
||||
break;
|
||||
}
|
||||
subscriber.next(start++);
|
||||
if (subscriber.closed) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
};
|
||||
return RangeObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.RangeObservable = RangeObservable;
|
||||
//# sourceMappingURL=RangeObservable.js.map
|
1
node_modules/rxjs/observable/RangeObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/RangeObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RangeObservable.js","sourceRoot":"","sources":["../../src/observable/RangeObservable.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAI3C;;;;GAIG;AACH;IAAqC,mCAAkB;IA+DrD,yBAAY,KAAa,EACb,KAAa,EACb,SAAsB;QAChC,iBAAO,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IApED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACI,sBAAM,GAAb,UAAc,KAAiB,EACjB,KAAiB,EACjB,SAAsB;QAFtB,qBAAiB,GAAjB,SAAiB;QACjB,qBAAiB,GAAjB,SAAiB;QAE7B,MAAM,CAAC,IAAI,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACtD,CAAC;IAEM,wBAAQ,GAAf,UAAgB,KAAU;QAEhB,uBAAK,EAAE,mBAAK,EAAE,mBAAK,EAAE,6BAAU,CAAW;QAElD,EAAE,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;YACnB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,CAAC;QACT,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEvB,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,MAAM,CAAC;QACT,CAAC;QAED,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;QACxB,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;QAEjB,IAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAeD,oCAAoC,CAAC,oCAAU,GAAV,UAAW,UAA8B;QAC5E,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACrD,YAAK,EAAE,YAAK,EAAE,YAAK,EAAE,sBAAU;aAChC,CAAC,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,GAAG,CAAC;gBACF,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC;oBACrB,UAAU,CAAC,QAAQ,EAAE,CAAC;oBACtB,KAAK,CAAC;gBACR,CAAC;gBACD,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;gBACzB,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;oBACtB,KAAK,CAAC;gBACR,CAAC;YACH,CAAC,QAAQ,IAAI,EAAE;QACjB,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AA/FD,CAAqC,uBAAU,GA+F9C;AA/FY,uBAAe,kBA+F3B,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\nimport { Observable } from '../Observable';\nimport { TeardownLogic } from '../Subscription';\nimport { Subscriber } from '../Subscriber';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class RangeObservable extends Observable<number> {\n\n /**\n * Creates an Observable that emits a sequence of numbers within a specified\n * range.\n *\n * <span class=\"informal\">Emits a sequence of numbers in a range.</span>\n *\n * <img src=\"./img/range.png\" width=\"100%\">\n *\n * `range` operator emits a range of sequential integers, in order, where you\n * select the `start` of the range and its `length`. By default, uses no\n * IScheduler and just delivers the notifications synchronously, but may use\n * an optional IScheduler to regulate those deliveries.\n *\n * @example <caption>Emits the numbers 1 to 10</caption>\n * var numbers = Rx.Observable.range(1, 10);\n * numbers.subscribe(x => console.log(x));\n *\n * @see {@link timer}\n * @see {@link interval}\n *\n * @param {number} [start=0] The value of the first integer in the sequence.\n * @param {number} [count=0] The number of sequential integers to generate.\n * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling\n * the emissions of the notifications.\n * @return {Observable} An Observable of numbers that emits a finite range of\n * sequential integers.\n * @static true\n * @name range\n * @owner Observable\n */\n static create(start: number = 0,\n count: number = 0,\n scheduler?: IScheduler): Observable<number> {\n return new RangeObservable(start, count, scheduler);\n }\n\n static dispatch(state: any) {\n\n const { start, index, count, subscriber } = state;\n\n if (index >= count) {\n subscriber.complete();\n return;\n }\n\n subscriber.next(start);\n\n if (subscriber.closed) {\n return;\n }\n\n state.index = index + 1;\n state.start = start + 1;\n\n (<any> this).schedule(state);\n }\n\n private start: number;\n private _count: number;\n private scheduler: IScheduler;\n\n constructor(start: number,\n count: number,\n scheduler?: IScheduler) {\n super();\n this.start = start;\n this._count = count;\n this.scheduler = scheduler;\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<number>): TeardownLogic {\n let index = 0;\n let start = this.start;\n const count = this._count;\n const scheduler = this.scheduler;\n\n if (scheduler) {\n return scheduler.schedule(RangeObservable.dispatch, 0, {\n index, count, start, subscriber\n });\n } else {\n do {\n if (index++ >= count) {\n subscriber.complete();\n break;\n }\n subscriber.next(start++);\n if (subscriber.closed) {\n break;\n }\n } while (true);\n }\n }\n}\n"]}
|
18
node_modules/rxjs/observable/ScalarObservable.d.ts
generated
vendored
Normal file
18
node_modules/rxjs/observable/ScalarObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class ScalarObservable<T> extends Observable<T> {
|
||||
value: T;
|
||||
private scheduler;
|
||||
static create<T>(value: T, scheduler?: IScheduler): ScalarObservable<T>;
|
||||
static dispatch(state: any): void;
|
||||
_isScalar: boolean;
|
||||
constructor(value: T, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
58
node_modules/rxjs/observable/ScalarObservable.js
generated
vendored
Normal file
58
node_modules/rxjs/observable/ScalarObservable.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var ScalarObservable = (function (_super) {
|
||||
__extends(ScalarObservable, _super);
|
||||
function ScalarObservable(value, scheduler) {
|
||||
_super.call(this);
|
||||
this.value = value;
|
||||
this.scheduler = scheduler;
|
||||
this._isScalar = true;
|
||||
if (scheduler) {
|
||||
this._isScalar = false;
|
||||
}
|
||||
}
|
||||
ScalarObservable.create = function (value, scheduler) {
|
||||
return new ScalarObservable(value, scheduler);
|
||||
};
|
||||
ScalarObservable.dispatch = function (state) {
|
||||
var done = state.done, value = state.value, subscriber = state.subscriber;
|
||||
if (done) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
subscriber.next(value);
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
state.done = true;
|
||||
this.schedule(state);
|
||||
};
|
||||
/** @deprecated internal use only */ ScalarObservable.prototype._subscribe = function (subscriber) {
|
||||
var value = this.value;
|
||||
var scheduler = this.scheduler;
|
||||
if (scheduler) {
|
||||
return scheduler.schedule(ScalarObservable.dispatch, 0, {
|
||||
done: false, value: value, subscriber: subscriber
|
||||
});
|
||||
}
|
||||
else {
|
||||
subscriber.next(value);
|
||||
if (!subscriber.closed) {
|
||||
subscriber.complete();
|
||||
}
|
||||
}
|
||||
};
|
||||
return ScalarObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.ScalarObservable = ScalarObservable;
|
||||
//# sourceMappingURL=ScalarObservable.js.map
|
1
node_modules/rxjs/observable/ScalarObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/ScalarObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ScalarObservable.js","sourceRoot":"","sources":["../../src/observable/ScalarObservable.ts"],"names":[],"mappings":";;;;;;AACA,2BAA2B,eAAe,CAAC,CAAA;AAI3C;;;;GAIG;AACH;IAAyC,oCAAa;IAwBpD,0BAAmB,KAAQ,EAAU,SAAsB;QACzD,iBAAO,CAAC;QADS,UAAK,GAAL,KAAK,CAAG;QAAU,cAAS,GAAT,SAAS,CAAa;QAF3D,cAAS,GAAY,IAAI,CAAC;QAIxB,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IA5BM,uBAAM,GAAb,UAAiB,KAAQ,EAAE,SAAsB;QAC/C,MAAM,CAAC,IAAI,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAEM,yBAAQ,GAAf,UAAgB,KAAU;QAChB,qBAAI,EAAE,mBAAK,EAAE,6BAAU,CAAW;QAE1C,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACT,UAAU,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,CAAC;QACT,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,MAAM,CAAC;QACT,CAAC;QAED,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACX,IAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAWD,oCAAoC,CAAC,qCAAU,GAAV,UAAW,UAAyB;QACvE,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACtD,IAAI,EAAE,KAAK,EAAE,YAAK,EAAE,sBAAU;aAC/B,CAAC,CAAC;QACL,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBACvB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AA9CD,CAAyC,uBAAU,GA8ClD;AA9CY,wBAAgB,mBA8C5B,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { TeardownLogic } from '../Subscription';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class ScalarObservable<T> extends Observable<T> {\n static create<T>(value: T, scheduler?: IScheduler): ScalarObservable<T> {\n return new ScalarObservable(value, scheduler);\n }\n\n static dispatch(state: any): void {\n const { done, value, subscriber } = state;\n\n if (done) {\n subscriber.complete();\n return;\n }\n\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n\n state.done = true;\n (<any> this).schedule(state);\n }\n\n _isScalar: boolean = true;\n\n constructor(public value: T, private scheduler?: IScheduler) {\n super();\n if (scheduler) {\n this._isScalar = false;\n }\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic {\n const value = this.value;\n const scheduler = this.scheduler;\n\n if (scheduler) {\n return scheduler.schedule(ScalarObservable.dispatch, 0, {\n done: false, value, subscriber\n });\n } else {\n subscriber.next(value);\n if (!subscriber.closed) {\n subscriber.complete();\n }\n }\n }\n}\n"]}
|
23
node_modules/rxjs/observable/SubscribeOnObservable.d.ts
generated
vendored
Normal file
23
node_modules/rxjs/observable/SubscribeOnObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Action } from '../scheduler/Action';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { Observable } from '../Observable';
|
||||
export interface DispatchArg<T> {
|
||||
source: Observable<T>;
|
||||
subscriber: Subscriber<T>;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class SubscribeOnObservable<T> extends Observable<T> {
|
||||
source: Observable<T>;
|
||||
private delayTime;
|
||||
private scheduler;
|
||||
static create<T>(source: Observable<T>, delay?: number, scheduler?: IScheduler): Observable<T>;
|
||||
static dispatch<T>(this: Action<T>, arg: DispatchArg<T>): Subscription;
|
||||
constructor(source: Observable<T>, delayTime?: number, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): Subscription;
|
||||
}
|
51
node_modules/rxjs/observable/SubscribeOnObservable.js
generated
vendored
Normal file
51
node_modules/rxjs/observable/SubscribeOnObservable.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var asap_1 = require('../scheduler/asap');
|
||||
var isNumeric_1 = require('../util/isNumeric');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var SubscribeOnObservable = (function (_super) {
|
||||
__extends(SubscribeOnObservable, _super);
|
||||
function SubscribeOnObservable(source, delayTime, scheduler) {
|
||||
if (delayTime === void 0) { delayTime = 0; }
|
||||
if (scheduler === void 0) { scheduler = asap_1.asap; }
|
||||
_super.call(this);
|
||||
this.source = source;
|
||||
this.delayTime = delayTime;
|
||||
this.scheduler = scheduler;
|
||||
if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) {
|
||||
this.delayTime = 0;
|
||||
}
|
||||
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
||||
this.scheduler = asap_1.asap;
|
||||
}
|
||||
}
|
||||
SubscribeOnObservable.create = function (source, delay, scheduler) {
|
||||
if (delay === void 0) { delay = 0; }
|
||||
if (scheduler === void 0) { scheduler = asap_1.asap; }
|
||||
return new SubscribeOnObservable(source, delay, scheduler);
|
||||
};
|
||||
SubscribeOnObservable.dispatch = function (arg) {
|
||||
var source = arg.source, subscriber = arg.subscriber;
|
||||
return this.add(source.subscribe(subscriber));
|
||||
};
|
||||
/** @deprecated internal use only */ SubscribeOnObservable.prototype._subscribe = function (subscriber) {
|
||||
var delay = this.delayTime;
|
||||
var source = this.source;
|
||||
var scheduler = this.scheduler;
|
||||
return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
|
||||
source: source, subscriber: subscriber
|
||||
});
|
||||
};
|
||||
return SubscribeOnObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.SubscribeOnObservable = SubscribeOnObservable;
|
||||
//# sourceMappingURL=SubscribeOnObservable.js.map
|
1
node_modules/rxjs/observable/SubscribeOnObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/SubscribeOnObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SubscribeOnObservable.js","sourceRoot":"","sources":["../../src/observable/SubscribeOnObservable.ts"],"names":[],"mappings":";;;;;;AAIA,2BAA2B,eAAe,CAAC,CAAA;AAC3C,qBAAqB,mBAAmB,CAAC,CAAA;AACzC,0BAA0B,mBAAmB,CAAC,CAAA;AAO9C;;;;GAIG;AACH;IAA8C,yCAAa;IAUzD,+BAAmB,MAAqB,EACpB,SAAqB,EACrB,SAA4B;QADpC,yBAA6B,GAA7B,aAA6B;QAC7B,yBAAoC,GAApC,uBAAoC;QAC9C,iBAAO,CAAC;QAHS,WAAM,GAAN,MAAM,CAAe;QACpB,cAAS,GAAT,SAAS,CAAY;QACrB,cAAS,GAAT,SAAS,CAAmB;QAE9C,EAAE,CAAC,CAAC,CAAC,qBAAS,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3C,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACrB,CAAC;QACD,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC;YAC3D,IAAI,CAAC,SAAS,GAAG,WAAI,CAAC;QACxB,CAAC;IACH,CAAC;IAnBM,4BAAM,GAAb,UAAiB,MAAqB,EAAE,KAAiB,EAAE,SAA4B;QAA/C,qBAAiB,GAAjB,SAAiB;QAAE,yBAA4B,GAA5B,uBAA4B;QACrF,MAAM,CAAC,IAAI,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7D,CAAC;IAEM,8BAAQ,GAAf,UAAoC,GAAmB;QAC7C,uBAAM,EAAE,2BAAU,CAAS;QACnC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAChD,CAAC;IAcD,oCAAoC,CAAC,0CAAU,GAAV,UAAW,UAAyB;QACvE,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;QAC7B,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,qBAAqB,CAAC,QAAQ,EAAE,KAAK,EAAE;YAC/D,cAAM,EAAE,sBAAU;SACnB,CAAC,CAAC;IACL,CAAC;IACH,4BAAC;AAAD,CAAC,AA/BD,CAA8C,uBAAU,GA+BvD;AA/BY,6BAAqB,wBA+BjC,CAAA","sourcesContent":["import { Action } from '../scheduler/Action';\nimport { IScheduler } from '../Scheduler';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { Observable } from '../Observable';\nimport { asap } from '../scheduler/asap';\nimport { isNumeric } from '../util/isNumeric';\n\nexport interface DispatchArg<T> {\n source: Observable<T>;\n subscriber: Subscriber<T>;\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class SubscribeOnObservable<T> extends Observable<T> {\n static create<T>(source: Observable<T>, delay: number = 0, scheduler: IScheduler = asap): Observable<T> {\n return new SubscribeOnObservable(source, delay, scheduler);\n }\n\n static dispatch<T>(this: Action<T>, arg: DispatchArg<T>): Subscription {\n const { source, subscriber } = arg;\n return this.add(source.subscribe(subscriber));\n }\n\n constructor(public source: Observable<T>,\n private delayTime: number = 0,\n private scheduler: IScheduler = asap) {\n super();\n if (!isNumeric(delayTime) || delayTime < 0) {\n this.delayTime = 0;\n }\n if (!scheduler || typeof scheduler.schedule !== 'function') {\n this.scheduler = asap;\n }\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>) {\n const delay = this.delayTime;\n const source = this.source;\n const scheduler = this.scheduler;\n\n return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {\n source, subscriber\n });\n }\n}\n"]}
|
60
node_modules/rxjs/observable/TimerObservable.d.ts
generated
vendored
Normal file
60
node_modules/rxjs/observable/TimerObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { IScheduler } from '../Scheduler';
|
||||
import { Observable } from '../Observable';
|
||||
import { TeardownLogic } from '../Subscription';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class TimerObservable extends Observable<number> {
|
||||
/**
|
||||
* Creates an Observable that starts emitting after an `initialDelay` and
|
||||
* emits ever increasing numbers after each `period` of time thereafter.
|
||||
*
|
||||
* <span class="informal">Its like {@link interval}, but you can specify when
|
||||
* should the emissions start.</span>
|
||||
*
|
||||
* <img src="./img/timer.png" width="100%">
|
||||
*
|
||||
* `timer` returns an Observable that emits an infinite sequence of ascending
|
||||
* integers, with a constant interval of time, `period` of your choosing
|
||||
* between those emissions. The first emission happens after the specified
|
||||
* `initialDelay`. The initial delay may be a {@link Date}. By default, this
|
||||
* operator uses the `async` IScheduler to provide a notion of time, but you
|
||||
* may pass any IScheduler to it. If `period` is not specified, the output
|
||||
* Observable emits only one value, `0`. Otherwise, it emits an infinite
|
||||
* sequence.
|
||||
*
|
||||
* @example <caption>Emits ascending numbers, one every second (1000ms), starting after 3 seconds</caption>
|
||||
* var numbers = Rx.Observable.timer(3000, 1000);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Emits one number after five seconds</caption>
|
||||
* var numbers = Rx.Observable.timer(5000);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link interval}
|
||||
* @see {@link delay}
|
||||
*
|
||||
* @param {number|Date} initialDelay The initial delay time to wait before
|
||||
* emitting the first value of `0`.
|
||||
* @param {number} [period] The period of time between emissions of the
|
||||
* subsequent numbers.
|
||||
* @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling
|
||||
* the emission of values, and providing a notion of "time".
|
||||
* @return {Observable} An Observable that emits a `0` after the
|
||||
* `initialDelay` and ever increasing numbers after each `period` of time
|
||||
* thereafter.
|
||||
* @static true
|
||||
* @name timer
|
||||
* @owner Observable
|
||||
*/
|
||||
static create(initialDelay?: number | Date, period?: number | IScheduler, scheduler?: IScheduler): Observable<number>;
|
||||
static dispatch(state: any): any;
|
||||
private period;
|
||||
private dueTime;
|
||||
private scheduler;
|
||||
constructor(dueTime?: number | Date, period?: number | IScheduler, scheduler?: IScheduler);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<number>): TeardownLogic;
|
||||
}
|
107
node_modules/rxjs/observable/TimerObservable.js
generated
vendored
Normal file
107
node_modules/rxjs/observable/TimerObservable.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var isNumeric_1 = require('../util/isNumeric');
|
||||
var Observable_1 = require('../Observable');
|
||||
var async_1 = require('../scheduler/async');
|
||||
var isScheduler_1 = require('../util/isScheduler');
|
||||
var isDate_1 = require('../util/isDate');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var TimerObservable = (function (_super) {
|
||||
__extends(TimerObservable, _super);
|
||||
function TimerObservable(dueTime, period, scheduler) {
|
||||
if (dueTime === void 0) { dueTime = 0; }
|
||||
_super.call(this);
|
||||
this.period = -1;
|
||||
this.dueTime = 0;
|
||||
if (isNumeric_1.isNumeric(period)) {
|
||||
this.period = Number(period) < 1 && 1 || Number(period);
|
||||
}
|
||||
else if (isScheduler_1.isScheduler(period)) {
|
||||
scheduler = period;
|
||||
}
|
||||
if (!isScheduler_1.isScheduler(scheduler)) {
|
||||
scheduler = async_1.async;
|
||||
}
|
||||
this.scheduler = scheduler;
|
||||
this.dueTime = isDate_1.isDate(dueTime) ?
|
||||
(+dueTime - this.scheduler.now()) :
|
||||
dueTime;
|
||||
}
|
||||
/**
|
||||
* Creates an Observable that starts emitting after an `initialDelay` and
|
||||
* emits ever increasing numbers after each `period` of time thereafter.
|
||||
*
|
||||
* <span class="informal">Its like {@link interval}, but you can specify when
|
||||
* should the emissions start.</span>
|
||||
*
|
||||
* <img src="./img/timer.png" width="100%">
|
||||
*
|
||||
* `timer` returns an Observable that emits an infinite sequence of ascending
|
||||
* integers, with a constant interval of time, `period` of your choosing
|
||||
* between those emissions. The first emission happens after the specified
|
||||
* `initialDelay`. The initial delay may be a {@link Date}. By default, this
|
||||
* operator uses the `async` IScheduler to provide a notion of time, but you
|
||||
* may pass any IScheduler to it. If `period` is not specified, the output
|
||||
* Observable emits only one value, `0`. Otherwise, it emits an infinite
|
||||
* sequence.
|
||||
*
|
||||
* @example <caption>Emits ascending numbers, one every second (1000ms), starting after 3 seconds</caption>
|
||||
* var numbers = Rx.Observable.timer(3000, 1000);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @example <caption>Emits one number after five seconds</caption>
|
||||
* var numbers = Rx.Observable.timer(5000);
|
||||
* numbers.subscribe(x => console.log(x));
|
||||
*
|
||||
* @see {@link interval}
|
||||
* @see {@link delay}
|
||||
*
|
||||
* @param {number|Date} initialDelay The initial delay time to wait before
|
||||
* emitting the first value of `0`.
|
||||
* @param {number} [period] The period of time between emissions of the
|
||||
* subsequent numbers.
|
||||
* @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling
|
||||
* the emission of values, and providing a notion of "time".
|
||||
* @return {Observable} An Observable that emits a `0` after the
|
||||
* `initialDelay` and ever increasing numbers after each `period` of time
|
||||
* thereafter.
|
||||
* @static true
|
||||
* @name timer
|
||||
* @owner Observable
|
||||
*/
|
||||
TimerObservable.create = function (initialDelay, period, scheduler) {
|
||||
if (initialDelay === void 0) { initialDelay = 0; }
|
||||
return new TimerObservable(initialDelay, period, scheduler);
|
||||
};
|
||||
TimerObservable.dispatch = function (state) {
|
||||
var index = state.index, period = state.period, subscriber = state.subscriber;
|
||||
var action = this;
|
||||
subscriber.next(index);
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
else if (period === -1) {
|
||||
return subscriber.complete();
|
||||
}
|
||||
state.index = index + 1;
|
||||
action.schedule(state, period);
|
||||
};
|
||||
/** @deprecated internal use only */ TimerObservable.prototype._subscribe = function (subscriber) {
|
||||
var index = 0;
|
||||
var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler;
|
||||
return scheduler.schedule(TimerObservable.dispatch, dueTime, {
|
||||
index: index, period: period, subscriber: subscriber
|
||||
});
|
||||
};
|
||||
return TimerObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.TimerObservable = TimerObservable;
|
||||
//# sourceMappingURL=TimerObservable.js.map
|
1
node_modules/rxjs/observable/TimerObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/TimerObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
node_modules/rxjs/observable/UsingObservable.d.ts
generated
vendored
Normal file
15
node_modules/rxjs/observable/UsingObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Observable, SubscribableOrPromise } from '../Observable';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { AnonymousSubscription, TeardownLogic } from '../Subscription';
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class UsingObservable<T> extends Observable<T> {
|
||||
private resourceFactory;
|
||||
private observableFactory;
|
||||
static create<T>(resourceFactory: () => AnonymousSubscription | void, observableFactory: (resource: AnonymousSubscription) => SubscribableOrPromise<T> | void): Observable<T>;
|
||||
constructor(resourceFactory: () => AnonymousSubscription | void, observableFactory: (resource: AnonymousSubscription) => SubscribableOrPromise<T> | void);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
61
node_modules/rxjs/observable/UsingObservable.js
generated
vendored
Normal file
61
node_modules/rxjs/observable/UsingObservable.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Observable_1 = require('../Observable');
|
||||
var subscribeToResult_1 = require('../util/subscribeToResult');
|
||||
var OuterSubscriber_1 = require('../OuterSubscriber');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var UsingObservable = (function (_super) {
|
||||
__extends(UsingObservable, _super);
|
||||
function UsingObservable(resourceFactory, observableFactory) {
|
||||
_super.call(this);
|
||||
this.resourceFactory = resourceFactory;
|
||||
this.observableFactory = observableFactory;
|
||||
}
|
||||
UsingObservable.create = function (resourceFactory, observableFactory) {
|
||||
return new UsingObservable(resourceFactory, observableFactory);
|
||||
};
|
||||
/** @deprecated internal use only */ UsingObservable.prototype._subscribe = function (subscriber) {
|
||||
var _a = this, resourceFactory = _a.resourceFactory, observableFactory = _a.observableFactory;
|
||||
var resource;
|
||||
try {
|
||||
resource = resourceFactory();
|
||||
return new UsingSubscriber(subscriber, resource, observableFactory);
|
||||
}
|
||||
catch (err) {
|
||||
subscriber.error(err);
|
||||
}
|
||||
};
|
||||
return UsingObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.UsingObservable = UsingObservable;
|
||||
var UsingSubscriber = (function (_super) {
|
||||
__extends(UsingSubscriber, _super);
|
||||
function UsingSubscriber(destination, resource, observableFactory) {
|
||||
_super.call(this, destination);
|
||||
this.resource = resource;
|
||||
this.observableFactory = observableFactory;
|
||||
destination.add(resource);
|
||||
this.tryUse();
|
||||
}
|
||||
UsingSubscriber.prototype.tryUse = function () {
|
||||
try {
|
||||
var source = this.observableFactory.call(this, this.resource);
|
||||
if (source) {
|
||||
this.add(subscribeToResult_1.subscribeToResult(this, source));
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this._error(err);
|
||||
}
|
||||
};
|
||||
return UsingSubscriber;
|
||||
}(OuterSubscriber_1.OuterSubscriber));
|
||||
//# sourceMappingURL=UsingObservable.js.map
|
1
node_modules/rxjs/observable/UsingObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/UsingObservable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"UsingObservable.js","sourceRoot":"","sources":["../../src/observable/UsingObservable.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAkD,eAAe,CAAC,CAAA;AAIlE,kCAAkC,2BAA2B,CAAC,CAAA;AAC9D,gCAAgC,oBAAoB,CAAC,CAAA;AACrD;;;;GAIG;AACH;IAAwC,mCAAa;IAOnD,yBAAoB,eAAmD,EACnD,iBAAuF;QACzG,iBAAO,CAAC;QAFU,oBAAe,GAAf,eAAe,CAAoC;QACnD,sBAAiB,GAAjB,iBAAiB,CAAsE;IAE3G,CAAC;IARM,sBAAM,GAAb,UAAiB,eAAmD,EACnD,iBAAuF;QACtG,MAAM,CAAC,IAAI,eAAe,CAAI,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACpE,CAAC;IAOD,oCAAoC,CAAC,oCAAU,GAAV,UAAW,UAAyB;QACvE,IAAA,SAAmD,EAA3C,oCAAe,EAAE,wCAAiB,CAAU;QAEpD,IAAI,QAA+B,CAAC;QAEpC,IAAI,CAAC;YACH,QAAQ,GAA0B,eAAe,EAAE,CAAC;YACpD,MAAM,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACtE,CAAE;QAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AAxBD,CAAwC,uBAAU,GAwBjD;AAxBY,uBAAe,kBAwB3B,CAAA;AAED;IAAiC,mCAAqB;IACpD,yBAAY,WAA0B,EAClB,QAA+B,EAC/B,iBAAuF;QACzG,kBAAM,WAAW,CAAC,CAAC;QAFD,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,sBAAiB,GAAjB,iBAAiB,CAAsE;QAEzG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEO,gCAAM,GAAd;QACE,IAAI,CAAC;YACH,IAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBACX,IAAI,CAAC,GAAG,CAAC,qCAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YAC5C,CAAC;QACH,CAAE;QAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AAnBD,CAAiC,iCAAe,GAmB/C","sourcesContent":["import { Observable, SubscribableOrPromise } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { AnonymousSubscription, TeardownLogic } from '../Subscription';\n\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n */\nexport class UsingObservable<T> extends Observable<T> {\n\n static create<T>(resourceFactory: () => AnonymousSubscription | void,\n observableFactory: (resource: AnonymousSubscription) => SubscribableOrPromise<T> | void): Observable<T> {\n return new UsingObservable<T>(resourceFactory, observableFactory);\n }\n\n constructor(private resourceFactory: () => AnonymousSubscription | void,\n private observableFactory: (resource: AnonymousSubscription) => SubscribableOrPromise<T> | void) {\n super();\n }\n\n /** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic {\n const { resourceFactory, observableFactory } = this;\n\n let resource: AnonymousSubscription;\n\n try {\n resource = <AnonymousSubscription>resourceFactory();\n return new UsingSubscriber(subscriber, resource, observableFactory);\n } catch (err) {\n subscriber.error(err);\n }\n }\n}\n\nclass UsingSubscriber<T> extends OuterSubscriber<T, T> {\n constructor(destination: Subscriber<T>,\n private resource: AnonymousSubscription,\n private observableFactory: (resource: AnonymousSubscription) => SubscribableOrPromise<T> | void) {\n super(destination);\n destination.add(resource);\n this.tryUse();\n }\n\n private tryUse(): void {\n try {\n const source = this.observableFactory.call(this, this.resource);\n if (source) {\n this.add(subscribeToResult(this, source));\n }\n } catch (err) {\n this._error(err);\n }\n }\n}\n"]}
|
2
node_modules/rxjs/observable/bindCallback.d.ts
generated
vendored
Normal file
2
node_modules/rxjs/observable/bindCallback.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { BoundCallbackObservable } from './BoundCallbackObservable';
|
||||
export declare const bindCallback: typeof BoundCallbackObservable.create;
|
4
node_modules/rxjs/observable/bindCallback.js
generated
vendored
Normal file
4
node_modules/rxjs/observable/bindCallback.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
var BoundCallbackObservable_1 = require('./BoundCallbackObservable');
|
||||
exports.bindCallback = BoundCallbackObservable_1.BoundCallbackObservable.create;
|
||||
//# sourceMappingURL=bindCallback.js.map
|
1
node_modules/rxjs/observable/bindCallback.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/bindCallback.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bindCallback.js","sourceRoot":"","sources":["../../src/observable/bindCallback.ts"],"names":[],"mappings":";AAAA,wCAA0C,2BAA2B,CAAC,CAAA;AAEzD,oBAAY,GAAG,iDAAuB,CAAC,MAAM,CAAC","sourcesContent":["import { BoundCallbackObservable } from './BoundCallbackObservable';\n\nexport const bindCallback = BoundCallbackObservable.create;"]}
|
2
node_modules/rxjs/observable/bindNodeCallback.d.ts
generated
vendored
Normal file
2
node_modules/rxjs/observable/bindNodeCallback.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { BoundNodeCallbackObservable } from './BoundNodeCallbackObservable';
|
||||
export declare const bindNodeCallback: typeof BoundNodeCallbackObservable.create;
|
4
node_modules/rxjs/observable/bindNodeCallback.js
generated
vendored
Normal file
4
node_modules/rxjs/observable/bindNodeCallback.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
var BoundNodeCallbackObservable_1 = require('./BoundNodeCallbackObservable');
|
||||
exports.bindNodeCallback = BoundNodeCallbackObservable_1.BoundNodeCallbackObservable.create;
|
||||
//# sourceMappingURL=bindNodeCallback.js.map
|
1
node_modules/rxjs/observable/bindNodeCallback.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/bindNodeCallback.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bindNodeCallback.js","sourceRoot":"","sources":["../../src/observable/bindNodeCallback.ts"],"names":[],"mappings":";AAAA,4CAA8C,+BAA+B,CAAC,CAAA;AAEjE,wBAAgB,GAAG,yDAA2B,CAAC,MAAM,CAAC","sourcesContent":["import { BoundNodeCallbackObservable } from './BoundNodeCallbackObservable';\n\nexport const bindNodeCallback = BoundNodeCallbackObservable.create;"]}
|
20
node_modules/rxjs/observable/combineLatest.d.ts
generated
vendored
Normal file
20
node_modules/rxjs/observable/combineLatest.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Observable, ObservableInput } from '../Observable';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
export declare function combineLatest<T, R>(v1: ObservableInput<T>, project: (v1: T) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T, T2, R>(v1: ObservableInput<T>, v2: ObservableInput<T2>, project: (v1: T, v2: T2) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T, T2, T3, R>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, project: (v1: T, v2: T2, v3: T3) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T, T2, T3, T4, R>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, project: (v1: T, v2: T2, v3: T3, v4: T4) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5, R>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5, T6, R>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T, T2>(v1: ObservableInput<T>, v2: ObservableInput<T2>, scheduler?: IScheduler): Observable<[T, T2]>;
|
||||
export declare function combineLatest<T, T2, T3>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, scheduler?: IScheduler): Observable<[T, T2, T3]>;
|
||||
export declare function combineLatest<T, T2, T3, T4>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, scheduler?: IScheduler): Observable<[T, T2, T3, T4]>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, scheduler?: IScheduler): Observable<[T, T2, T3, T4, T5]>;
|
||||
export declare function combineLatest<T, T2, T3, T4, T5, T6>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, scheduler?: IScheduler): Observable<[T, T2, T3, T4, T5, T6]>;
|
||||
export declare function combineLatest<T>(array: ObservableInput<T>[], scheduler?: IScheduler): Observable<T[]>;
|
||||
export declare function combineLatest<R>(array: ObservableInput<any>[], scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T, R>(array: ObservableInput<T>[], project: (...values: Array<T>) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<R>(array: ObservableInput<any>[], project: (...values: Array<any>) => R, scheduler?: IScheduler): Observable<R>;
|
||||
export declare function combineLatest<T>(...observables: Array<ObservableInput<T> | IScheduler>): Observable<T[]>;
|
||||
export declare function combineLatest<T, R>(...observables: Array<ObservableInput<T> | ((...values: Array<T>) => R) | IScheduler>): Observable<R>;
|
||||
export declare function combineLatest<R>(...observables: Array<ObservableInput<any> | ((...values: Array<any>) => R) | IScheduler>): Observable<R>;
|
136
node_modules/rxjs/observable/combineLatest.js
generated
vendored
Normal file
136
node_modules/rxjs/observable/combineLatest.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
var isScheduler_1 = require('../util/isScheduler');
|
||||
var isArray_1 = require('../util/isArray');
|
||||
var ArrayObservable_1 = require('./ArrayObservable');
|
||||
var combineLatest_1 = require('../operators/combineLatest');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Combines multiple Observables to create an Observable whose values are
|
||||
* calculated from the latest values of each of its input Observables.
|
||||
*
|
||||
* <span class="informal">Whenever any input Observable emits a value, it
|
||||
* computes a formula using the latest values from all the inputs, then emits
|
||||
* the output of that formula.</span>
|
||||
*
|
||||
* <img src="./img/combineLatest.png" width="100%">
|
||||
*
|
||||
* `combineLatest` combines the values from all the Observables passed as
|
||||
* arguments. This is done by subscribing to each Observable in order and,
|
||||
* whenever any Observable emits, collecting an array of the most recent
|
||||
* values from each Observable. So if you pass `n` Observables to operator,
|
||||
* returned Observable will always emit an array of `n` values, in order
|
||||
* corresponding to order of passed Observables (value from the first Observable
|
||||
* on the first place and so on).
|
||||
*
|
||||
* Static version of `combineLatest` accepts either an array of Observables
|
||||
* or each Observable can be put directly as an argument. Note that array of
|
||||
* Observables is good choice, if you don't know beforehand how many Observables
|
||||
* you will combine. Passing empty array will result in Observable that
|
||||
* completes immediately.
|
||||
*
|
||||
* To ensure output array has always the same length, `combineLatest` will
|
||||
* actually wait for all input Observables to emit at least once,
|
||||
* before it starts emitting results. This means if some Observable emits
|
||||
* values before other Observables started emitting, all that values but last
|
||||
* will be lost. On the other hand, is some Observable does not emit value but
|
||||
* completes, resulting Observable will complete at the same moment without
|
||||
* emitting anything, since it will be now impossible to include value from
|
||||
* completed Observable in resulting array. Also, if some input Observable does
|
||||
* not emit any value and never completes, `combineLatest` will also never emit
|
||||
* and never complete, since, again, it will wait for all streams to emit some
|
||||
* value.
|
||||
*
|
||||
* If at least one Observable was passed to `combineLatest` and all passed Observables
|
||||
* emitted something, resulting Observable will complete when all combined
|
||||
* streams complete. So even if some Observable completes, result of
|
||||
* `combineLatest` will still emit values when other Observables do. In case
|
||||
* of completed Observable, its value from now on will always be the last
|
||||
* emitted value. On the other hand, if any Observable errors, `combineLatest`
|
||||
* will error immediately as well, and all other Observables will be unsubscribed.
|
||||
*
|
||||
* `combineLatest` accepts as optional parameter `project` function, which takes
|
||||
* as arguments all values that would normally be emitted by resulting Observable.
|
||||
* `project` can return any kind of value, which will be then emitted by Observable
|
||||
* instead of default array. Note that `project` does not take as argument that array
|
||||
* of values, but values themselves. That means default `project` can be imagined
|
||||
* as function that takes all its arguments and puts them into an array.
|
||||
*
|
||||
*
|
||||
* @example <caption>Combine two timer Observables</caption>
|
||||
* const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now
|
||||
* const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now
|
||||
* const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer);
|
||||
* combinedTimers.subscribe(value => console.log(value));
|
||||
* // Logs
|
||||
* // [0, 0] after 0.5s
|
||||
* // [1, 0] after 1s
|
||||
* // [1, 1] after 1.5s
|
||||
* // [2, 1] after 2s
|
||||
*
|
||||
*
|
||||
* @example <caption>Combine an array of Observables</caption>
|
||||
* const observables = [1, 5, 10].map(
|
||||
* n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds
|
||||
* );
|
||||
* const combined = Rx.Observable.combineLatest(observables);
|
||||
* combined.subscribe(value => console.log(value));
|
||||
* // Logs
|
||||
* // [0, 0, 0] immediately
|
||||
* // [1, 0, 0] after 1s
|
||||
* // [1, 5, 0] after 5s
|
||||
* // [1, 5, 10] after 10s
|
||||
*
|
||||
*
|
||||
* @example <caption>Use project function to dynamically calculate the Body-Mass Index</caption>
|
||||
* var weight = Rx.Observable.of(70, 72, 76, 79, 75);
|
||||
* var height = Rx.Observable.of(1.76, 1.77, 1.78);
|
||||
* var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h));
|
||||
* bmi.subscribe(x => console.log('BMI is ' + x));
|
||||
*
|
||||
* // With output to console:
|
||||
* // BMI is 24.212293388429753
|
||||
* // BMI is 23.93948099205209
|
||||
* // BMI is 23.671253629592222
|
||||
*
|
||||
*
|
||||
* @see {@link combineAll}
|
||||
* @see {@link merge}
|
||||
* @see {@link withLatestFrom}
|
||||
*
|
||||
* @param {ObservableInput} observable1 An input Observable to combine with other Observables.
|
||||
* @param {ObservableInput} observable2 An input Observable to combine with other Observables.
|
||||
* More than one input Observables may be given as arguments
|
||||
* or an array of Observables may be given as the first argument.
|
||||
* @param {function} [project] An optional function to project the values from
|
||||
* the combined latest values into a new value on the output Observable.
|
||||
* @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to
|
||||
* each input Observable.
|
||||
* @return {Observable} An Observable of projected values from the most recent
|
||||
* values from each input Observable, or an array of the most recent values from
|
||||
* each input Observable.
|
||||
* @static true
|
||||
* @name combineLatest
|
||||
* @owner Observable
|
||||
*/
|
||||
function combineLatest() {
|
||||
var observables = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
observables[_i - 0] = arguments[_i];
|
||||
}
|
||||
var project = null;
|
||||
var scheduler = null;
|
||||
if (isScheduler_1.isScheduler(observables[observables.length - 1])) {
|
||||
scheduler = observables.pop();
|
||||
}
|
||||
if (typeof observables[observables.length - 1] === 'function') {
|
||||
project = observables.pop();
|
||||
}
|
||||
// if the first and only other argument besides the resultSelector is an array
|
||||
// assume it's been called with `combineLatest([obs1, obs2, obs3], project)`
|
||||
if (observables.length === 1 && isArray_1.isArray(observables[0])) {
|
||||
observables = observables[0];
|
||||
}
|
||||
return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_1.CombineLatestOperator(project));
|
||||
}
|
||||
exports.combineLatest = combineLatest;
|
||||
//# sourceMappingURL=combineLatest.js.map
|
1
node_modules/rxjs/observable/combineLatest.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/combineLatest.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
node_modules/rxjs/observable/concat.d.ts
generated
vendored
Normal file
10
node_modules/rxjs/observable/concat.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Observable, ObservableInput } from '../Observable';
|
||||
import { IScheduler } from '../Scheduler';
|
||||
export declare function concat<T>(v1: ObservableInput<T>, scheduler?: IScheduler): Observable<T>;
|
||||
export declare function concat<T, T2>(v1: ObservableInput<T>, v2: ObservableInput<T2>, scheduler?: IScheduler): Observable<T | T2>;
|
||||
export declare function concat<T, T2, T3>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, scheduler?: IScheduler): Observable<T | T2 | T3>;
|
||||
export declare function concat<T, T2, T3, T4>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, scheduler?: IScheduler): Observable<T | T2 | T3 | T4>;
|
||||
export declare function concat<T, T2, T3, T4, T5>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, scheduler?: IScheduler): Observable<T | T2 | T3 | T4 | T5>;
|
||||
export declare function concat<T, T2, T3, T4, T5, T6>(v1: ObservableInput<T>, v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, scheduler?: IScheduler): Observable<T | T2 | T3 | T4 | T5 | T6>;
|
||||
export declare function concat<T>(...observables: (ObservableInput<T> | IScheduler)[]): Observable<T>;
|
||||
export declare function concat<T, R>(...observables: (ObservableInput<any> | IScheduler)[]): Observable<R>;
|
111
node_modules/rxjs/observable/concat.js
generated
vendored
Normal file
111
node_modules/rxjs/observable/concat.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
var isScheduler_1 = require('../util/isScheduler');
|
||||
var of_1 = require('./of');
|
||||
var from_1 = require('./from');
|
||||
var concatAll_1 = require('../operators/concatAll');
|
||||
/* tslint:enable:max-line-length */
|
||||
/**
|
||||
* Creates an output Observable which sequentially emits all values from given
|
||||
* Observable and then moves on to the next.
|
||||
*
|
||||
* <span class="informal">Concatenates multiple Observables together by
|
||||
* sequentially emitting their values, one Observable after the other.</span>
|
||||
*
|
||||
* <img src="./img/concat.png" width="100%">
|
||||
*
|
||||
* `concat` joins multiple Observables together, by subscribing to them one at a time and
|
||||
* merging their results into the output Observable. You can pass either an array of
|
||||
* Observables, or put them directly as arguments. Passing an empty array will result
|
||||
* in Observable that completes immediately.
|
||||
*
|
||||
* `concat` will subscribe to first input Observable and emit all its values, without
|
||||
* changing or affecting them in any way. When that Observable completes, it will
|
||||
* subscribe to then next Observable passed and, again, emit its values. This will be
|
||||
* repeated, until the operator runs out of Observables. When last input Observable completes,
|
||||
* `concat` will complete as well. At any given moment only one Observable passed to operator
|
||||
* emits values. If you would like to emit values from passed Observables concurrently, check out
|
||||
* {@link merge} instead, especially with optional `concurrent` parameter. As a matter of fact,
|
||||
* `concat` is an equivalent of `merge` operator with `concurrent` parameter set to `1`.
|
||||
*
|
||||
* Note that if some input Observable never completes, `concat` will also never complete
|
||||
* and Observables following the one that did not complete will never be subscribed. On the other
|
||||
* hand, if some Observable simply completes immediately after it is subscribed, it will be
|
||||
* invisible for `concat`, which will just move on to the next Observable.
|
||||
*
|
||||
* If any Observable in chain errors, instead of passing control to the next Observable,
|
||||
* `concat` will error immediately as well. Observables that would be subscribed after
|
||||
* the one that emitted error, never will.
|
||||
*
|
||||
* If you pass to `concat` the same Observable many times, its stream of values
|
||||
* will be "replayed" on every subscription, which means you can repeat given Observable
|
||||
* as many times as you like. If passing the same Observable to `concat` 1000 times becomes tedious,
|
||||
* you can always use {@link repeat}.
|
||||
*
|
||||
* @example <caption>Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10</caption>
|
||||
* var timer = Rx.Observable.interval(1000).take(4);
|
||||
* var sequence = Rx.Observable.range(1, 10);
|
||||
* var result = Rx.Observable.concat(timer, sequence);
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // results in:
|
||||
* // 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10
|
||||
*
|
||||
*
|
||||
* @example <caption>Concatenate an array of 3 Observables</caption>
|
||||
* var timer1 = Rx.Observable.interval(1000).take(10);
|
||||
* var timer2 = Rx.Observable.interval(2000).take(6);
|
||||
* var timer3 = Rx.Observable.interval(500).take(10);
|
||||
* var result = Rx.Observable.concat([timer1, timer2, timer3]); // note that array is passed
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // results in the following:
|
||||
* // (Prints to console sequentially)
|
||||
* // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9
|
||||
* // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5
|
||||
* // -500ms-> 0 -500ms-> 1 -500ms-> ... 9
|
||||
*
|
||||
*
|
||||
* @example <caption>Concatenate the same Observable to repeat it</caption>
|
||||
* const timer = Rx.Observable.interval(1000).take(2);
|
||||
*
|
||||
* Rx.Observable.concat(timer, timer) // concating the same Observable!
|
||||
* .subscribe(
|
||||
* value => console.log(value),
|
||||
* err => {},
|
||||
* () => console.log('...and it is done!')
|
||||
* );
|
||||
*
|
||||
* // Logs:
|
||||
* // 0 after 1s
|
||||
* // 1 after 2s
|
||||
* // 0 after 3s
|
||||
* // 1 after 4s
|
||||
* // "...and it is done!" also after 4s
|
||||
*
|
||||
* @see {@link concatAll}
|
||||
* @see {@link concatMap}
|
||||
* @see {@link concatMapTo}
|
||||
*
|
||||
* @param {ObservableInput} input1 An input Observable to concatenate with others.
|
||||
* @param {ObservableInput} input2 An input Observable to concatenate with others.
|
||||
* More than one input Observables may be given as argument.
|
||||
* @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each
|
||||
* Observable subscription on.
|
||||
* @return {Observable} All values of each passed Observable merged into a
|
||||
* single Observable, in order, in serial fashion.
|
||||
* @static true
|
||||
* @name concat
|
||||
* @owner Observable
|
||||
*/
|
||||
function concat() {
|
||||
var observables = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
observables[_i - 0] = arguments[_i];
|
||||
}
|
||||
if (observables.length === 1 || (observables.length === 2 && isScheduler_1.isScheduler(observables[1]))) {
|
||||
return from_1.from(observables[0]);
|
||||
}
|
||||
return concatAll_1.concatAll()(of_1.of.apply(void 0, observables));
|
||||
}
|
||||
exports.concat = concat;
|
||||
//# sourceMappingURL=concat.js.map
|
1
node_modules/rxjs/observable/concat.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/concat.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/rxjs/observable/defer.d.ts
generated
vendored
Normal file
2
node_modules/rxjs/observable/defer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { DeferObservable } from './DeferObservable';
|
||||
export declare const defer: typeof DeferObservable.create;
|
4
node_modules/rxjs/observable/defer.js
generated
vendored
Normal file
4
node_modules/rxjs/observable/defer.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
var DeferObservable_1 = require('./DeferObservable');
|
||||
exports.defer = DeferObservable_1.DeferObservable.create;
|
||||
//# sourceMappingURL=defer.js.map
|
1
node_modules/rxjs/observable/defer.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/defer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defer.js","sourceRoot":"","sources":["../../src/observable/defer.ts"],"names":[],"mappings":";AAAA,gCAAkC,mBAAmB,CAAC,CAAA;AAEzC,aAAK,GAAG,iCAAe,CAAC,MAAM,CAAC","sourcesContent":["import { DeferObservable } from './DeferObservable';\n\nexport const defer = DeferObservable.create;"]}
|
137
node_modules/rxjs/observable/dom/AjaxObservable.d.ts
generated
vendored
Normal file
137
node_modules/rxjs/observable/dom/AjaxObservable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
import { Observable } from '../../Observable';
|
||||
import { Subscriber } from '../../Subscriber';
|
||||
import { TeardownLogic } from '../../Subscription';
|
||||
export interface AjaxRequest {
|
||||
url?: string;
|
||||
body?: any;
|
||||
user?: string;
|
||||
async?: boolean;
|
||||
method?: string;
|
||||
headers?: Object;
|
||||
timeout?: number;
|
||||
password?: string;
|
||||
hasContent?: boolean;
|
||||
crossDomain?: boolean;
|
||||
withCredentials?: boolean;
|
||||
createXHR?: () => XMLHttpRequest;
|
||||
progressSubscriber?: Subscriber<any>;
|
||||
responseType?: string;
|
||||
}
|
||||
export interface AjaxCreationMethod {
|
||||
(urlOrRequest: string | AjaxRequest): Observable<AjaxResponse>;
|
||||
get(url: string, headers?: Object): Observable<AjaxResponse>;
|
||||
post(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
|
||||
put(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
|
||||
patch(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
|
||||
delete(url: string, headers?: Object): Observable<AjaxResponse>;
|
||||
getJSON<T>(url: string, headers?: Object): Observable<T>;
|
||||
}
|
||||
export declare function ajaxGet(url: string, headers?: Object): AjaxObservable<AjaxResponse>;
|
||||
export declare function ajaxPost(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
|
||||
export declare function ajaxDelete(url: string, headers?: Object): Observable<AjaxResponse>;
|
||||
export declare function ajaxPut(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
|
||||
export declare function ajaxPatch(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
|
||||
export declare function ajaxGetJSON<T>(url: string, headers?: Object): Observable<T>;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class AjaxObservable<T> extends Observable<T> {
|
||||
/**
|
||||
* Creates an observable for an Ajax request with either a request object with
|
||||
* url, headers, etc or a string for a URL.
|
||||
*
|
||||
* @example
|
||||
* source = Rx.Observable.ajax('/products');
|
||||
* source = Rx.Observable.ajax({ url: 'products', method: 'GET' });
|
||||
*
|
||||
* @param {string|Object} request Can be one of the following:
|
||||
* A string of the URL to make the Ajax call.
|
||||
* An object with the following properties
|
||||
* - url: URL of the request
|
||||
* - body: The body of the request
|
||||
* - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE
|
||||
* - async: Whether the request is async
|
||||
* - headers: Optional headers
|
||||
* - crossDomain: true if a cross domain request, else false
|
||||
* - createXHR: a function to override if you need to use an alternate
|
||||
* XMLHttpRequest implementation.
|
||||
* - resultSelector: a function to use to alter the output value type of
|
||||
* the Observable. Gets {@link AjaxResponse} as an argument.
|
||||
* @return {Observable} An observable sequence containing the XMLHttpRequest.
|
||||
* @static true
|
||||
* @name ajax
|
||||
* @owner Observable
|
||||
*/
|
||||
static create: AjaxCreationMethod;
|
||||
private request;
|
||||
constructor(urlOrRequest: string | AjaxRequest);
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): TeardownLogic;
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
export declare class AjaxSubscriber<T> extends Subscriber<Event> {
|
||||
request: AjaxRequest;
|
||||
private xhr;
|
||||
private done;
|
||||
constructor(destination: Subscriber<T>, request: AjaxRequest);
|
||||
next(e: Event): void;
|
||||
private send();
|
||||
private serializeBody(body, contentType?);
|
||||
private setHeaders(xhr, headers);
|
||||
private setupEvents(xhr, request);
|
||||
unsubscribe(): void;
|
||||
}
|
||||
/**
|
||||
* A normalized AJAX response.
|
||||
*
|
||||
* @see {@link ajax}
|
||||
*
|
||||
* @class AjaxResponse
|
||||
*/
|
||||
export declare class AjaxResponse {
|
||||
originalEvent: Event;
|
||||
xhr: XMLHttpRequest;
|
||||
request: AjaxRequest;
|
||||
/** @type {number} The HTTP status code */
|
||||
status: number;
|
||||
/** @type {string|ArrayBuffer|Document|object|any} The response data */
|
||||
response: any;
|
||||
/** @type {string} The raw responseText */
|
||||
responseText: string;
|
||||
/** @type {string} The responseType (e.g. 'json', 'arraybuffer', or 'xml') */
|
||||
responseType: string;
|
||||
constructor(originalEvent: Event, xhr: XMLHttpRequest, request: AjaxRequest);
|
||||
}
|
||||
/**
|
||||
* A normalized AJAX error.
|
||||
*
|
||||
* @see {@link ajax}
|
||||
*
|
||||
* @class AjaxError
|
||||
*/
|
||||
export declare class AjaxError extends Error {
|
||||
/** @type {XMLHttpRequest} The XHR instance associated with the error */
|
||||
xhr: XMLHttpRequest;
|
||||
/** @type {AjaxRequest} The AjaxRequest associated with the error */
|
||||
request: AjaxRequest;
|
||||
/** @type {number} The HTTP status code */
|
||||
status: number;
|
||||
/** @type {string} The responseType (e.g. 'json', 'arraybuffer', or 'xml') */
|
||||
responseType: string;
|
||||
/** @type {string|ArrayBuffer|Document|object|any} The response data */
|
||||
response: any;
|
||||
constructor(message: string, xhr: XMLHttpRequest, request: AjaxRequest);
|
||||
}
|
||||
/**
|
||||
* @see {@link ajax}
|
||||
*
|
||||
* @class AjaxTimeoutError
|
||||
*/
|
||||
export declare class AjaxTimeoutError extends AjaxError {
|
||||
constructor(xhr: XMLHttpRequest, request: AjaxRequest);
|
||||
}
|
426
node_modules/rxjs/observable/dom/AjaxObservable.js
generated
vendored
Normal file
426
node_modules/rxjs/observable/dom/AjaxObservable.js
generated
vendored
Normal file
@@ -0,0 +1,426 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var root_1 = require('../../util/root');
|
||||
var tryCatch_1 = require('../../util/tryCatch');
|
||||
var errorObject_1 = require('../../util/errorObject');
|
||||
var Observable_1 = require('../../Observable');
|
||||
var Subscriber_1 = require('../../Subscriber');
|
||||
var map_1 = require('../../operators/map');
|
||||
function getCORSRequest() {
|
||||
if (root_1.root.XMLHttpRequest) {
|
||||
return new root_1.root.XMLHttpRequest();
|
||||
}
|
||||
else if (!!root_1.root.XDomainRequest) {
|
||||
return new root_1.root.XDomainRequest();
|
||||
}
|
||||
else {
|
||||
throw new Error('CORS is not supported by your browser');
|
||||
}
|
||||
}
|
||||
function getXMLHttpRequest() {
|
||||
if (root_1.root.XMLHttpRequest) {
|
||||
return new root_1.root.XMLHttpRequest();
|
||||
}
|
||||
else {
|
||||
var progId = void 0;
|
||||
try {
|
||||
var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
try {
|
||||
progId = progIds[i];
|
||||
if (new root_1.root.ActiveXObject(progId)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
return new root_1.root.ActiveXObject(progId);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error('XMLHttpRequest is not supported by your browser');
|
||||
}
|
||||
}
|
||||
}
|
||||
function ajaxGet(url, headers) {
|
||||
if (headers === void 0) { headers = null; }
|
||||
return new AjaxObservable({ method: 'GET', url: url, headers: headers });
|
||||
}
|
||||
exports.ajaxGet = ajaxGet;
|
||||
;
|
||||
function ajaxPost(url, body, headers) {
|
||||
return new AjaxObservable({ method: 'POST', url: url, body: body, headers: headers });
|
||||
}
|
||||
exports.ajaxPost = ajaxPost;
|
||||
;
|
||||
function ajaxDelete(url, headers) {
|
||||
return new AjaxObservable({ method: 'DELETE', url: url, headers: headers });
|
||||
}
|
||||
exports.ajaxDelete = ajaxDelete;
|
||||
;
|
||||
function ajaxPut(url, body, headers) {
|
||||
return new AjaxObservable({ method: 'PUT', url: url, body: body, headers: headers });
|
||||
}
|
||||
exports.ajaxPut = ajaxPut;
|
||||
;
|
||||
function ajaxPatch(url, body, headers) {
|
||||
return new AjaxObservable({ method: 'PATCH', url: url, body: body, headers: headers });
|
||||
}
|
||||
exports.ajaxPatch = ajaxPatch;
|
||||
;
|
||||
var mapResponse = map_1.map(function (x, index) { return x.response; });
|
||||
function ajaxGetJSON(url, headers) {
|
||||
return mapResponse(new AjaxObservable({
|
||||
method: 'GET',
|
||||
url: url,
|
||||
responseType: 'json',
|
||||
headers: headers
|
||||
}));
|
||||
}
|
||||
exports.ajaxGetJSON = ajaxGetJSON;
|
||||
;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var AjaxObservable = (function (_super) {
|
||||
__extends(AjaxObservable, _super);
|
||||
function AjaxObservable(urlOrRequest) {
|
||||
_super.call(this);
|
||||
var request = {
|
||||
async: true,
|
||||
createXHR: function () {
|
||||
return this.crossDomain ? getCORSRequest.call(this) : getXMLHttpRequest();
|
||||
},
|
||||
crossDomain: false,
|
||||
withCredentials: false,
|
||||
headers: {},
|
||||
method: 'GET',
|
||||
responseType: 'json',
|
||||
timeout: 0
|
||||
};
|
||||
if (typeof urlOrRequest === 'string') {
|
||||
request.url = urlOrRequest;
|
||||
}
|
||||
else {
|
||||
for (var prop in urlOrRequest) {
|
||||
if (urlOrRequest.hasOwnProperty(prop)) {
|
||||
request[prop] = urlOrRequest[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.request = request;
|
||||
}
|
||||
/** @deprecated internal use only */ AjaxObservable.prototype._subscribe = function (subscriber) {
|
||||
return new AjaxSubscriber(subscriber, this.request);
|
||||
};
|
||||
/**
|
||||
* Creates an observable for an Ajax request with either a request object with
|
||||
* url, headers, etc or a string for a URL.
|
||||
*
|
||||
* @example
|
||||
* source = Rx.Observable.ajax('/products');
|
||||
* source = Rx.Observable.ajax({ url: 'products', method: 'GET' });
|
||||
*
|
||||
* @param {string|Object} request Can be one of the following:
|
||||
* A string of the URL to make the Ajax call.
|
||||
* An object with the following properties
|
||||
* - url: URL of the request
|
||||
* - body: The body of the request
|
||||
* - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE
|
||||
* - async: Whether the request is async
|
||||
* - headers: Optional headers
|
||||
* - crossDomain: true if a cross domain request, else false
|
||||
* - createXHR: a function to override if you need to use an alternate
|
||||
* XMLHttpRequest implementation.
|
||||
* - resultSelector: a function to use to alter the output value type of
|
||||
* the Observable. Gets {@link AjaxResponse} as an argument.
|
||||
* @return {Observable} An observable sequence containing the XMLHttpRequest.
|
||||
* @static true
|
||||
* @name ajax
|
||||
* @owner Observable
|
||||
*/
|
||||
AjaxObservable.create = (function () {
|
||||
var create = function (urlOrRequest) {
|
||||
return new AjaxObservable(urlOrRequest);
|
||||
};
|
||||
create.get = ajaxGet;
|
||||
create.post = ajaxPost;
|
||||
create.delete = ajaxDelete;
|
||||
create.put = ajaxPut;
|
||||
create.patch = ajaxPatch;
|
||||
create.getJSON = ajaxGetJSON;
|
||||
return create;
|
||||
})();
|
||||
return AjaxObservable;
|
||||
}(Observable_1.Observable));
|
||||
exports.AjaxObservable = AjaxObservable;
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
var AjaxSubscriber = (function (_super) {
|
||||
__extends(AjaxSubscriber, _super);
|
||||
function AjaxSubscriber(destination, request) {
|
||||
_super.call(this, destination);
|
||||
this.request = request;
|
||||
this.done = false;
|
||||
var headers = request.headers = request.headers || {};
|
||||
// force CORS if requested
|
||||
if (!request.crossDomain && !headers['X-Requested-With']) {
|
||||
headers['X-Requested-With'] = 'XMLHttpRequest';
|
||||
}
|
||||
// ensure content type is set
|
||||
if (!('Content-Type' in headers) && !(root_1.root.FormData && request.body instanceof root_1.root.FormData) && typeof request.body !== 'undefined') {
|
||||
headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||
}
|
||||
// properly serialize body
|
||||
request.body = this.serializeBody(request.body, request.headers['Content-Type']);
|
||||
this.send();
|
||||
}
|
||||
AjaxSubscriber.prototype.next = function (e) {
|
||||
this.done = true;
|
||||
var _a = this, xhr = _a.xhr, request = _a.request, destination = _a.destination;
|
||||
var response = new AjaxResponse(e, xhr, request);
|
||||
destination.next(response);
|
||||
};
|
||||
AjaxSubscriber.prototype.send = function () {
|
||||
var _a = this, request = _a.request, _b = _a.request, user = _b.user, method = _b.method, url = _b.url, async = _b.async, password = _b.password, headers = _b.headers, body = _b.body;
|
||||
var createXHR = request.createXHR;
|
||||
var xhr = tryCatch_1.tryCatch(createXHR).call(request);
|
||||
if (xhr === errorObject_1.errorObject) {
|
||||
this.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
this.xhr = xhr;
|
||||
// set up the events before open XHR
|
||||
// https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
|
||||
// You need to add the event listeners before calling open() on the request.
|
||||
// Otherwise the progress events will not fire.
|
||||
this.setupEvents(xhr, request);
|
||||
// open XHR
|
||||
var result = void 0;
|
||||
if (user) {
|
||||
result = tryCatch_1.tryCatch(xhr.open).call(xhr, method, url, async, user, password);
|
||||
}
|
||||
else {
|
||||
result = tryCatch_1.tryCatch(xhr.open).call(xhr, method, url, async);
|
||||
}
|
||||
if (result === errorObject_1.errorObject) {
|
||||
this.error(errorObject_1.errorObject.e);
|
||||
return null;
|
||||
}
|
||||
// timeout, responseType and withCredentials can be set once the XHR is open
|
||||
if (async) {
|
||||
xhr.timeout = request.timeout;
|
||||
xhr.responseType = request.responseType;
|
||||
}
|
||||
if ('withCredentials' in xhr) {
|
||||
xhr.withCredentials = !!request.withCredentials;
|
||||
}
|
||||
// set headers
|
||||
this.setHeaders(xhr, headers);
|
||||
// finally send the request
|
||||
result = body ? tryCatch_1.tryCatch(xhr.send).call(xhr, body) : tryCatch_1.tryCatch(xhr.send).call(xhr);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
this.error(errorObject_1.errorObject.e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return xhr;
|
||||
};
|
||||
AjaxSubscriber.prototype.serializeBody = function (body, contentType) {
|
||||
if (!body || typeof body === 'string') {
|
||||
return body;
|
||||
}
|
||||
else if (root_1.root.FormData && body instanceof root_1.root.FormData) {
|
||||
return body;
|
||||
}
|
||||
if (contentType) {
|
||||
var splitIndex = contentType.indexOf(';');
|
||||
if (splitIndex !== -1) {
|
||||
contentType = contentType.substring(0, splitIndex);
|
||||
}
|
||||
}
|
||||
switch (contentType) {
|
||||
case 'application/x-www-form-urlencoded':
|
||||
return Object.keys(body).map(function (key) { return (encodeURIComponent(key) + "=" + encodeURIComponent(body[key])); }).join('&');
|
||||
case 'application/json':
|
||||
return JSON.stringify(body);
|
||||
default:
|
||||
return body;
|
||||
}
|
||||
};
|
||||
AjaxSubscriber.prototype.setHeaders = function (xhr, headers) {
|
||||
for (var key in headers) {
|
||||
if (headers.hasOwnProperty(key)) {
|
||||
xhr.setRequestHeader(key, headers[key]);
|
||||
}
|
||||
}
|
||||
};
|
||||
AjaxSubscriber.prototype.setupEvents = function (xhr, request) {
|
||||
var progressSubscriber = request.progressSubscriber;
|
||||
function xhrTimeout(e) {
|
||||
var _a = xhrTimeout, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request;
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.error(e);
|
||||
}
|
||||
subscriber.error(new AjaxTimeoutError(this, request)); //TODO: Make betterer.
|
||||
}
|
||||
;
|
||||
xhr.ontimeout = xhrTimeout;
|
||||
xhrTimeout.request = request;
|
||||
xhrTimeout.subscriber = this;
|
||||
xhrTimeout.progressSubscriber = progressSubscriber;
|
||||
if (xhr.upload && 'withCredentials' in xhr) {
|
||||
if (progressSubscriber) {
|
||||
var xhrProgress_1;
|
||||
xhrProgress_1 = function (e) {
|
||||
var progressSubscriber = xhrProgress_1.progressSubscriber;
|
||||
progressSubscriber.next(e);
|
||||
};
|
||||
if (root_1.root.XDomainRequest) {
|
||||
xhr.onprogress = xhrProgress_1;
|
||||
}
|
||||
else {
|
||||
xhr.upload.onprogress = xhrProgress_1;
|
||||
}
|
||||
xhrProgress_1.progressSubscriber = progressSubscriber;
|
||||
}
|
||||
var xhrError_1;
|
||||
xhrError_1 = function (e) {
|
||||
var _a = xhrError_1, progressSubscriber = _a.progressSubscriber, subscriber = _a.subscriber, request = _a.request;
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.error(e);
|
||||
}
|
||||
subscriber.error(new AjaxError('ajax error', this, request));
|
||||
};
|
||||
xhr.onerror = xhrError_1;
|
||||
xhrError_1.request = request;
|
||||
xhrError_1.subscriber = this;
|
||||
xhrError_1.progressSubscriber = progressSubscriber;
|
||||
}
|
||||
function xhrReadyStateChange(e) {
|
||||
var _a = xhrReadyStateChange, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request;
|
||||
if (this.readyState === 4) {
|
||||
// normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
|
||||
var status_1 = this.status === 1223 ? 204 : this.status;
|
||||
var response = (this.responseType === 'text' ? (this.response || this.responseText) : this.response);
|
||||
// fix status code when it is 0 (0 status is undocumented).
|
||||
// Occurs when accessing file resources or on Android 4.1 stock browser
|
||||
// while retrieving files from application cache.
|
||||
if (status_1 === 0) {
|
||||
status_1 = response ? 200 : 0;
|
||||
}
|
||||
if (200 <= status_1 && status_1 < 300) {
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.complete();
|
||||
}
|
||||
subscriber.next(e);
|
||||
subscriber.complete();
|
||||
}
|
||||
else {
|
||||
if (progressSubscriber) {
|
||||
progressSubscriber.error(e);
|
||||
}
|
||||
subscriber.error(new AjaxError('ajax error ' + status_1, this, request));
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
xhr.onreadystatechange = xhrReadyStateChange;
|
||||
xhrReadyStateChange.subscriber = this;
|
||||
xhrReadyStateChange.progressSubscriber = progressSubscriber;
|
||||
xhrReadyStateChange.request = request;
|
||||
};
|
||||
AjaxSubscriber.prototype.unsubscribe = function () {
|
||||
var _a = this, done = _a.done, xhr = _a.xhr;
|
||||
if (!done && xhr && xhr.readyState !== 4 && typeof xhr.abort === 'function') {
|
||||
xhr.abort();
|
||||
}
|
||||
_super.prototype.unsubscribe.call(this);
|
||||
};
|
||||
return AjaxSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
exports.AjaxSubscriber = AjaxSubscriber;
|
||||
/**
|
||||
* A normalized AJAX response.
|
||||
*
|
||||
* @see {@link ajax}
|
||||
*
|
||||
* @class AjaxResponse
|
||||
*/
|
||||
var AjaxResponse = (function () {
|
||||
function AjaxResponse(originalEvent, xhr, request) {
|
||||
this.originalEvent = originalEvent;
|
||||
this.xhr = xhr;
|
||||
this.request = request;
|
||||
this.status = xhr.status;
|
||||
this.responseType = xhr.responseType || request.responseType;
|
||||
this.response = parseXhrResponse(this.responseType, xhr);
|
||||
}
|
||||
return AjaxResponse;
|
||||
}());
|
||||
exports.AjaxResponse = AjaxResponse;
|
||||
/**
|
||||
* A normalized AJAX error.
|
||||
*
|
||||
* @see {@link ajax}
|
||||
*
|
||||
* @class AjaxError
|
||||
*/
|
||||
var AjaxError = (function (_super) {
|
||||
__extends(AjaxError, _super);
|
||||
function AjaxError(message, xhr, request) {
|
||||
_super.call(this, message);
|
||||
this.message = message;
|
||||
this.xhr = xhr;
|
||||
this.request = request;
|
||||
this.status = xhr.status;
|
||||
this.responseType = xhr.responseType || request.responseType;
|
||||
this.response = parseXhrResponse(this.responseType, xhr);
|
||||
}
|
||||
return AjaxError;
|
||||
}(Error));
|
||||
exports.AjaxError = AjaxError;
|
||||
function parseXhrResponse(responseType, xhr) {
|
||||
switch (responseType) {
|
||||
case 'json':
|
||||
if ('response' in xhr) {
|
||||
//IE does not support json as responseType, parse it internally
|
||||
return xhr.responseType ? xhr.response : JSON.parse(xhr.response || xhr.responseText || 'null');
|
||||
}
|
||||
else {
|
||||
// HACK(benlesh): TypeScript shennanigans
|
||||
// tslint:disable-next-line:no-any latest TS seems to think xhr is "never" here.
|
||||
return JSON.parse(xhr.responseText || 'null');
|
||||
}
|
||||
case 'xml':
|
||||
return xhr.responseXML;
|
||||
case 'text':
|
||||
default:
|
||||
// HACK(benlesh): TypeScript shennanigans
|
||||
// tslint:disable-next-line:no-any latest TS seems to think xhr is "never" here.
|
||||
return ('response' in xhr) ? xhr.response : xhr.responseText;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @see {@link ajax}
|
||||
*
|
||||
* @class AjaxTimeoutError
|
||||
*/
|
||||
var AjaxTimeoutError = (function (_super) {
|
||||
__extends(AjaxTimeoutError, _super);
|
||||
function AjaxTimeoutError(xhr, request) {
|
||||
_super.call(this, 'ajax timeout', xhr, request);
|
||||
}
|
||||
return AjaxTimeoutError;
|
||||
}(AjaxError));
|
||||
exports.AjaxTimeoutError = AjaxTimeoutError;
|
||||
//# sourceMappingURL=AjaxObservable.js.map
|
1
node_modules/rxjs/observable/dom/AjaxObservable.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/dom/AjaxObservable.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
83
node_modules/rxjs/observable/dom/WebSocketSubject.d.ts
generated
vendored
Normal file
83
node_modules/rxjs/observable/dom/WebSocketSubject.d.ts
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
import { AnonymousSubject } from '../../Subject';
|
||||
import { Subscriber } from '../../Subscriber';
|
||||
import { Observable } from '../../Observable';
|
||||
import { Subscription } from '../../Subscription';
|
||||
import { Operator } from '../../Operator';
|
||||
import { Observer, NextObserver } from '../../Observer';
|
||||
export interface WebSocketSubjectConfig {
|
||||
url: string;
|
||||
protocol?: string | Array<string>;
|
||||
resultSelector?: <T>(e: MessageEvent) => T;
|
||||
openObserver?: NextObserver<Event>;
|
||||
closeObserver?: NextObserver<CloseEvent>;
|
||||
closingObserver?: NextObserver<void>;
|
||||
WebSocketCtor?: {
|
||||
new (url: string, protocol?: string | Array<string>): WebSocket;
|
||||
};
|
||||
binaryType?: 'blob' | 'arraybuffer';
|
||||
}
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
export declare class WebSocketSubject<T> extends AnonymousSubject<T> {
|
||||
url: string;
|
||||
protocol: string | Array<string>;
|
||||
socket: WebSocket;
|
||||
openObserver: NextObserver<Event>;
|
||||
closeObserver: NextObserver<CloseEvent>;
|
||||
closingObserver: NextObserver<void>;
|
||||
WebSocketCtor: {
|
||||
new (url: string, protocol?: string | Array<string>): WebSocket;
|
||||
};
|
||||
binaryType?: 'blob' | 'arraybuffer';
|
||||
private _output;
|
||||
resultSelector(e: MessageEvent): any;
|
||||
/**
|
||||
* Wrapper around the w3c-compatible WebSocket object provided by the browser.
|
||||
*
|
||||
* @example <caption>Wraps browser WebSocket</caption>
|
||||
*
|
||||
* let socket$ = Observable.webSocket('ws://localhost:8081');
|
||||
*
|
||||
* socket$.subscribe(
|
||||
* (msg) => console.log('message received: ' + msg),
|
||||
* (err) => console.log(err),
|
||||
* () => console.log('complete')
|
||||
* );
|
||||
*
|
||||
* socket$.next(JSON.stringify({ op: 'hello' }));
|
||||
*
|
||||
* @example <caption>Wraps WebSocket from nodejs-websocket (using node.js)</caption>
|
||||
*
|
||||
* import { w3cwebsocket } from 'websocket';
|
||||
*
|
||||
* let socket$ = Observable.webSocket({
|
||||
* url: 'ws://localhost:8081',
|
||||
* WebSocketCtor: w3cwebsocket
|
||||
* });
|
||||
*
|
||||
* socket$.subscribe(
|
||||
* (msg) => console.log('message received: ' + msg),
|
||||
* (err) => console.log(err),
|
||||
* () => console.log('complete')
|
||||
* );
|
||||
*
|
||||
* socket$.next(JSON.stringify({ op: 'hello' }));
|
||||
*
|
||||
* @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object
|
||||
* @return {WebSocketSubject}
|
||||
* @static true
|
||||
* @name webSocket
|
||||
* @owner Observable
|
||||
*/
|
||||
static create<T>(urlConfigOrSource: string | WebSocketSubjectConfig): WebSocketSubject<T>;
|
||||
constructor(urlConfigOrSource: string | WebSocketSubjectConfig | Observable<T>, destination?: Observer<T>);
|
||||
lift<R>(operator: Operator<T, R>): WebSocketSubject<R>;
|
||||
private _resetState();
|
||||
multiplex(subMsg: () => any, unsubMsg: () => any, messageFilter: (value: T) => boolean): Observable<any>;
|
||||
private _connectSocket();
|
||||
/** @deprecated internal use only */ _subscribe(subscriber: Subscriber<T>): Subscription;
|
||||
unsubscribe(): void;
|
||||
}
|
250
node_modules/rxjs/observable/dom/WebSocketSubject.js
generated
vendored
Normal file
250
node_modules/rxjs/observable/dom/WebSocketSubject.js
generated
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Subject_1 = require('../../Subject');
|
||||
var Subscriber_1 = require('../../Subscriber');
|
||||
var Observable_1 = require('../../Observable');
|
||||
var Subscription_1 = require('../../Subscription');
|
||||
var root_1 = require('../../util/root');
|
||||
var ReplaySubject_1 = require('../../ReplaySubject');
|
||||
var tryCatch_1 = require('../../util/tryCatch');
|
||||
var errorObject_1 = require('../../util/errorObject');
|
||||
var assign_1 = require('../../util/assign');
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @extends {Ignored}
|
||||
* @hide true
|
||||
*/
|
||||
var WebSocketSubject = (function (_super) {
|
||||
__extends(WebSocketSubject, _super);
|
||||
function WebSocketSubject(urlConfigOrSource, destination) {
|
||||
if (urlConfigOrSource instanceof Observable_1.Observable) {
|
||||
_super.call(this, destination, urlConfigOrSource);
|
||||
}
|
||||
else {
|
||||
_super.call(this);
|
||||
this.WebSocketCtor = root_1.root.WebSocket;
|
||||
this._output = new Subject_1.Subject();
|
||||
if (typeof urlConfigOrSource === 'string') {
|
||||
this.url = urlConfigOrSource;
|
||||
}
|
||||
else {
|
||||
// WARNING: config object could override important members here.
|
||||
assign_1.assign(this, urlConfigOrSource);
|
||||
}
|
||||
if (!this.WebSocketCtor) {
|
||||
throw new Error('no WebSocket constructor can be found');
|
||||
}
|
||||
this.destination = new ReplaySubject_1.ReplaySubject();
|
||||
}
|
||||
}
|
||||
WebSocketSubject.prototype.resultSelector = function (e) {
|
||||
return JSON.parse(e.data);
|
||||
};
|
||||
/**
|
||||
* Wrapper around the w3c-compatible WebSocket object provided by the browser.
|
||||
*
|
||||
* @example <caption>Wraps browser WebSocket</caption>
|
||||
*
|
||||
* let socket$ = Observable.webSocket('ws://localhost:8081');
|
||||
*
|
||||
* socket$.subscribe(
|
||||
* (msg) => console.log('message received: ' + msg),
|
||||
* (err) => console.log(err),
|
||||
* () => console.log('complete')
|
||||
* );
|
||||
*
|
||||
* socket$.next(JSON.stringify({ op: 'hello' }));
|
||||
*
|
||||
* @example <caption>Wraps WebSocket from nodejs-websocket (using node.js)</caption>
|
||||
*
|
||||
* import { w3cwebsocket } from 'websocket';
|
||||
*
|
||||
* let socket$ = Observable.webSocket({
|
||||
* url: 'ws://localhost:8081',
|
||||
* WebSocketCtor: w3cwebsocket
|
||||
* });
|
||||
*
|
||||
* socket$.subscribe(
|
||||
* (msg) => console.log('message received: ' + msg),
|
||||
* (err) => console.log(err),
|
||||
* () => console.log('complete')
|
||||
* );
|
||||
*
|
||||
* socket$.next(JSON.stringify({ op: 'hello' }));
|
||||
*
|
||||
* @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object
|
||||
* @return {WebSocketSubject}
|
||||
* @static true
|
||||
* @name webSocket
|
||||
* @owner Observable
|
||||
*/
|
||||
WebSocketSubject.create = function (urlConfigOrSource) {
|
||||
return new WebSocketSubject(urlConfigOrSource);
|
||||
};
|
||||
WebSocketSubject.prototype.lift = function (operator) {
|
||||
var sock = new WebSocketSubject(this, this.destination);
|
||||
sock.operator = operator;
|
||||
return sock;
|
||||
};
|
||||
WebSocketSubject.prototype._resetState = function () {
|
||||
this.socket = null;
|
||||
if (!this.source) {
|
||||
this.destination = new ReplaySubject_1.ReplaySubject();
|
||||
}
|
||||
this._output = new Subject_1.Subject();
|
||||
};
|
||||
// TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures
|
||||
WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) {
|
||||
var self = this;
|
||||
return new Observable_1.Observable(function (observer) {
|
||||
var result = tryCatch_1.tryCatch(subMsg)();
|
||||
if (result === errorObject_1.errorObject) {
|
||||
observer.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
self.next(result);
|
||||
}
|
||||
var subscription = self.subscribe(function (x) {
|
||||
var result = tryCatch_1.tryCatch(messageFilter)(x);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
observer.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else if (result) {
|
||||
observer.next(x);
|
||||
}
|
||||
}, function (err) { return observer.error(err); }, function () { return observer.complete(); });
|
||||
return function () {
|
||||
var result = tryCatch_1.tryCatch(unsubMsg)();
|
||||
if (result === errorObject_1.errorObject) {
|
||||
observer.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
self.next(result);
|
||||
}
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
});
|
||||
};
|
||||
WebSocketSubject.prototype._connectSocket = function () {
|
||||
var _this = this;
|
||||
var WebSocketCtor = this.WebSocketCtor;
|
||||
var observer = this._output;
|
||||
var socket = null;
|
||||
try {
|
||||
socket = this.protocol ?
|
||||
new WebSocketCtor(this.url, this.protocol) :
|
||||
new WebSocketCtor(this.url);
|
||||
this.socket = socket;
|
||||
if (this.binaryType) {
|
||||
this.socket.binaryType = this.binaryType;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
observer.error(e);
|
||||
return;
|
||||
}
|
||||
var subscription = new Subscription_1.Subscription(function () {
|
||||
_this.socket = null;
|
||||
if (socket && socket.readyState === 1) {
|
||||
socket.close();
|
||||
}
|
||||
});
|
||||
socket.onopen = function (e) {
|
||||
var openObserver = _this.openObserver;
|
||||
if (openObserver) {
|
||||
openObserver.next(e);
|
||||
}
|
||||
var queue = _this.destination;
|
||||
_this.destination = Subscriber_1.Subscriber.create(function (x) { return socket.readyState === 1 && socket.send(x); }, function (e) {
|
||||
var closingObserver = _this.closingObserver;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
if (e && e.code) {
|
||||
socket.close(e.code, e.reason);
|
||||
}
|
||||
else {
|
||||
observer.error(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' +
|
||||
'and an optional reason: { code: number, reason: string }'));
|
||||
}
|
||||
_this._resetState();
|
||||
}, function () {
|
||||
var closingObserver = _this.closingObserver;
|
||||
if (closingObserver) {
|
||||
closingObserver.next(undefined);
|
||||
}
|
||||
socket.close();
|
||||
_this._resetState();
|
||||
});
|
||||
if (queue && queue instanceof ReplaySubject_1.ReplaySubject) {
|
||||
subscription.add(queue.subscribe(_this.destination));
|
||||
}
|
||||
};
|
||||
socket.onerror = function (e) {
|
||||
_this._resetState();
|
||||
observer.error(e);
|
||||
};
|
||||
socket.onclose = function (e) {
|
||||
_this._resetState();
|
||||
var closeObserver = _this.closeObserver;
|
||||
if (closeObserver) {
|
||||
closeObserver.next(e);
|
||||
}
|
||||
if (e.wasClean) {
|
||||
observer.complete();
|
||||
}
|
||||
else {
|
||||
observer.error(e);
|
||||
}
|
||||
};
|
||||
socket.onmessage = function (e) {
|
||||
var result = tryCatch_1.tryCatch(_this.resultSelector)(e);
|
||||
if (result === errorObject_1.errorObject) {
|
||||
observer.error(errorObject_1.errorObject.e);
|
||||
}
|
||||
else {
|
||||
observer.next(result);
|
||||
}
|
||||
};
|
||||
};
|
||||
/** @deprecated internal use only */ WebSocketSubject.prototype._subscribe = function (subscriber) {
|
||||
var _this = this;
|
||||
var source = this.source;
|
||||
if (source) {
|
||||
return source.subscribe(subscriber);
|
||||
}
|
||||
if (!this.socket) {
|
||||
this._connectSocket();
|
||||
}
|
||||
var subscription = new Subscription_1.Subscription();
|
||||
subscription.add(this._output.subscribe(subscriber));
|
||||
subscription.add(function () {
|
||||
var socket = _this.socket;
|
||||
if (_this._output.observers.length === 0) {
|
||||
if (socket && socket.readyState === 1) {
|
||||
socket.close();
|
||||
}
|
||||
_this._resetState();
|
||||
}
|
||||
});
|
||||
return subscription;
|
||||
};
|
||||
WebSocketSubject.prototype.unsubscribe = function () {
|
||||
var _a = this, source = _a.source, socket = _a.socket;
|
||||
if (socket && socket.readyState === 1) {
|
||||
socket.close();
|
||||
this._resetState();
|
||||
}
|
||||
_super.prototype.unsubscribe.call(this);
|
||||
if (!source) {
|
||||
this.destination = new ReplaySubject_1.ReplaySubject();
|
||||
}
|
||||
};
|
||||
return WebSocketSubject;
|
||||
}(Subject_1.AnonymousSubject));
|
||||
exports.WebSocketSubject = WebSocketSubject;
|
||||
//# sourceMappingURL=WebSocketSubject.js.map
|
1
node_modules/rxjs/observable/dom/WebSocketSubject.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/dom/WebSocketSubject.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/rxjs/observable/dom/ajax.d.ts
generated
vendored
Normal file
2
node_modules/rxjs/observable/dom/ajax.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { AjaxCreationMethod } from './AjaxObservable';
|
||||
export declare const ajax: AjaxCreationMethod;
|
4
node_modules/rxjs/observable/dom/ajax.js
generated
vendored
Normal file
4
node_modules/rxjs/observable/dom/ajax.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
var AjaxObservable_1 = require('./AjaxObservable');
|
||||
exports.ajax = AjaxObservable_1.AjaxObservable.create;
|
||||
//# sourceMappingURL=ajax.js.map
|
1
node_modules/rxjs/observable/dom/ajax.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/dom/ajax.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ajax.js","sourceRoot":"","sources":["../../../src/observable/dom/ajax.ts"],"names":[],"mappings":";AAAA,+BAAqD,kBAAkB,CAAC,CAAA;AAE3D,YAAI,GAAuB,+BAAc,CAAC,MAAM,CAAC","sourcesContent":["import { AjaxObservable, AjaxCreationMethod } from './AjaxObservable';\n\nexport const ajax: AjaxCreationMethod = AjaxObservable.create;"]}
|
2
node_modules/rxjs/observable/dom/webSocket.d.ts
generated
vendored
Normal file
2
node_modules/rxjs/observable/dom/webSocket.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { WebSocketSubject } from './WebSocketSubject';
|
||||
export declare const webSocket: typeof WebSocketSubject.create;
|
4
node_modules/rxjs/observable/dom/webSocket.js
generated
vendored
Normal file
4
node_modules/rxjs/observable/dom/webSocket.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
var WebSocketSubject_1 = require('./WebSocketSubject');
|
||||
exports.webSocket = WebSocketSubject_1.WebSocketSubject.create;
|
||||
//# sourceMappingURL=webSocket.js.map
|
1
node_modules/rxjs/observable/dom/webSocket.js.map
generated
vendored
Normal file
1
node_modules/rxjs/observable/dom/webSocket.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"webSocket.js","sourceRoot":"","sources":["../../../src/observable/dom/webSocket.ts"],"names":[],"mappings":";AAAA,iCAAmC,oBAAoB,CAAC,CAAA;AAE3C,iBAAS,GAAG,mCAAgB,CAAC,MAAM,CAAC","sourcesContent":["import { WebSocketSubject } from './WebSocketSubject';\n\nexport const webSocket = WebSocketSubject.create;"]}
|
2
node_modules/rxjs/observable/empty.d.ts
generated
vendored
Normal file
2
node_modules/rxjs/observable/empty.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { EmptyObservable } from './EmptyObservable';
|
||||
export declare const empty: typeof EmptyObservable.create;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user