Tumortisch-Dist/resources/app/node_modules/rxjs/operator/timeout.js.map
2021-06-15 16:00:08 +02:00

1 line
4.2 KiB
Plaintext

{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../../src/operator/timeout.ts"],"names":[],"mappings":";AAAA,sBAAsB,oBAAoB,CAAC,CAAA;AAG3C,wBAAuC,sBAAsB,CAAC,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,iBAC2B,GAAkB,EAClB,SAA6B;IAA7B,yBAA6B,GAA7B,yBAA6B;IACtD,MAAM,CAAC,iBAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,IAAI,CAAkB,CAAC;AAC5D,CAAC;AAJe,eAAO,UAItB,CAAA","sourcesContent":["import { async } from '../scheduler/async';\nimport { IScheduler } from '../Scheduler';\nimport { Observable } from '../Observable';\nimport { timeout as higherOrder } from '../operators/timeout';\n\n/**\n *\n * Errors if Observable does not emit a value in given time span.\n *\n * <span class=\"informal\">Timeouts on Observable that doesn't emit values fast enough.</span>\n *\n * <img src=\"./img/timeout.png\" width=\"100%\">\n *\n * `timeout` operator accepts as an argument either a number or a Date.\n *\n * If number was provided, it returns an Observable that behaves like a source\n * Observable, unless there is a period of time where there is no value emitted.\n * So if you provide `100` as argument and first value comes after 50ms from\n * the moment of subscription, this value will be simply re-emitted by the resulting\n * Observable. If however after that 100ms passes without a second value being emitted,\n * stream will end with an error and source Observable will be unsubscribed.\n * These checks are performed throughout whole lifecycle of Observable - from the moment\n * it was subscribed to, until it completes or errors itself. Thus every value must be\n * emitted within specified period since previous value.\n *\n * If provided argument was Date, returned Observable behaves differently. It throws\n * if Observable did not complete before provided Date. This means that periods between\n * emission of particular values do not matter in this case. If Observable did not complete\n * before provided Date, source Observable will be unsubscribed. Other than that, resulting\n * stream behaves just as source Observable.\n *\n * `timeout` accepts also a Scheduler as a second parameter. It is used to schedule moment (or moments)\n * when returned Observable will check if source stream emitted value or completed.\n *\n * @example <caption>Check if ticks are emitted within certain timespan</caption>\n * const seconds = Rx.Observable.interval(1000);\n *\n * seconds.timeout(1100) // Let's use bigger timespan to be safe,\n * // since `interval` might fire a bit later then scheduled.\n * .subscribe(\n * value => console.log(value), // Will emit numbers just as regular `interval` would.\n * err => console.log(err) // Will never be called.\n * );\n *\n * seconds.timeout(900).subscribe(\n * value => console.log(value), // Will never be called.\n * err => console.log(err) // Will emit error before even first value is emitted,\n * // since it did not arrive within 900ms period.\n * );\n *\n * @example <caption>Use Date to check if Observable completed</caption>\n * const seconds = Rx.Observable.interval(1000);\n *\n * seconds.timeout(new Date(\"December 17, 2020 03:24:00\"))\n * .subscribe(\n * value => console.log(value), // Will emit values as regular `interval` would\n * // until December 17, 2020 at 03:24:00.\n * err => console.log(err) // On December 17, 2020 at 03:24:00 it will emit an error,\n * // since Observable did not complete by then.\n * );\n *\n * @see {@link timeoutWith}\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 {Scheduler} [scheduler] Scheduler controlling when timeout checks occur.\n * @return {Observable<T>} Observable that mirrors behaviour of source, unless timeout checks fail.\n * @method timeout\n * @owner Observable\n */\nexport function timeout<T>(this: Observable<T>,\n due: number | Date,\n scheduler: IScheduler = async): Observable<T> {\n return higherOrder(due, scheduler)(this) as Observable<T>;\n}\n"]}