lunaisadev-website-old/node_modules/rxjs/operator/timeoutWith.js.map

1 line
4.0 KiB
Plaintext
Raw Normal View History

2021-07-28 01:40:12 +00:00
{"version":3,"file":"timeoutWith.js","sourceRoot":"","sources":["../../src/operator/timeoutWith.ts"],"names":[],"mappings":";AACA,sBAAsB,oBAAoB,CAAC,CAAA;AAE3C,4BAA2C,0BAA0B,CAAC,CAAA;AAKtE,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAuD,GAAkB,EACvC,cAAkC,EAClC,SAA6B;IAA7B,yBAA6B,GAA7B,yBAA6B;IAC7D,MAAM,CAAC,yBAAW,CAAC,GAAG,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC,IAAW,CAAC,CAAC;AAClE,CAAC;AAJe,mBAAW,cAI1B,CAAA","sourcesContent":["import { IScheduler } from '../Scheduler';\nimport { async } from '../scheduler/async';\nimport { Observable, ObservableInput } from '../Observable';\nimport { timeoutWith as higherOrder } from '../operators/timeoutWith';\n\n/* tslint:disable:max-line-length */\nexport function timeoutWith<T>(this: Observable<T>, due: number | Date, withObservable: ObservableInput<T>, scheduler?: IScheduler): Observable<T>;\nexport function timeoutWith<T, R>(this: Observable<T>, due: number | Date, withObservable: ObservableInput<R>, scheduler?: IScheduler): Observable<T | R>;\n/* tslint:enable:max-line-length */\n\n/**\n *\n * Errors if Observable does not emit a value in given time span, in case of which\n * subscribes to the second Observable.\n *\n * <span class=\"informal\">It's a version of `timeout` operator that let's you specify fallback Observable.</span>\n *\n * <img src=\"./img/timeoutWith.png\" width=\"100%\">\n *\n * `timeoutWith` is a variation of `timeout` operator. It behaves exactly the same,\n * still accepting as a first argument either a number or a Date, which control - respectively -\n * when values of source Observable should be emitted or when it should complete.\n *\n * The only difference is that it accepts a second, required parameter. This parameter\n * should be an Observable which will be subscribed when source Observable fails any timeout check.\n * So whenever regular `timeout` would emit an error, `timeoutWith` will instead start re-emitting\n * values from second Observable. Note that this fallback Observable is not checked for timeouts\n * itself, so it can emit values and complete at arbitrary points in time. From the moment of a second\n * subscription, Observable returned from `timeoutWith` simply mirrors fallback stream. When that\n * stream completes, it completes as well.\n *\n * Scheduler, which in case of `timeout` is provided as as second argument, can be still provided\n * here - as a third, optional parameter. It still is used to schedule timeout checks and -\n * as a consequence - when second Observable will be subscribed, since subscription happens\n * immediately after failing check.\n *\n * @example <caption>Add fallback observable</caption>\n * const seconds = Rx.Observable.interval(1000);\n * const minutes = Rx.Observable.interval(60 * 1000);\n *\n * seconds.timeoutWith(900, minutes)\n * .subscribe(\n * value => console.log(value), // After 900ms, will start emitting `minutes`,\n * // since first value of `seconds` will not arrive fast enough.\n * err => console.log(err) // Would be called after 900ms in case of `timeout`,\n * // but here will never be called.\n * );\n *\n * @param {number|Date} due Number specifying period within which Observable must emit values\n * or Date specifying before when Observable should complete\n * @param {Observable<T>} withObservable Observable which will be subscribed if source fails timeout check.\n * @param {Scheduler} [scheduler] Scheduler controlling when timeout checks occur.\n * @return {Observable<T>} Observable that mirrors behaviour of source or, when timeout check fails, of an Observable\n * passed as a second parameter.\n * @method timeoutWith\n * @owner Observable\n */\nexport function timeoutWith<T, R>(this: Observable<T>, due: number | Date,\n withObservable: ObservableInput<R>,\n scheduler: IScheduler = async): Observable<T | R> {\n return higherOrder(due, withObservable, scheduler)(this