This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 231
/
delay-response.js.map
1 lines (1 loc) · 1.79 KB
/
delay-response.js.map
1
{"version":3,"file":"delay-response.js","sourceRoot":"","sources":["delay-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,0CAA0C;AAC1C,8FAA8F;AAC9F,MAAM,UAAU,aAAa,CAAI,SAAwB,EAAE,OAAe;IACxE,OAAO,IAAI,UAAU,CAAI,UAAA,QAAQ;QAC/B,IAAI,eAAe,GAAG,KAAK,CAAC;QAC5B,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,IAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CACtC,UAAA,KAAK;YACD,WAAW,GAAG,IAAI,CAAC;YACnB,UAAU,CAAC;gBACX,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrB,IAAI,eAAe,EAAE;oBACnB,QAAQ,CAAC,QAAQ,EAAE,CAAC;iBACrB;YACH,CAAC,EAAE,OAAO,CAAC,CAAC;QACd,CAAC,EACD,UAAA,KAAK,IAAI,OAAA,UAAU,CAAC,cAAM,OAAA,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAArB,CAAqB,EAAE,OAAO,CAAC,EAAhD,CAAgD,EACzD;YACE,eAAe,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,WAAW,EAAE;gBAChB,QAAQ,CAAC,QAAQ,EAAE,CAAC;aACrB;QACH,CAAC,CACF,CAAC;QACF,OAAO;YACL,OAAO,YAAY,CAAC,WAAW,EAAE,CAAC;QACpC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Observable } from 'rxjs';\n\n// Replaces use of RxJS delay. See v0.5.4.\n/** adds specified delay (in ms) to both next and error channels of the response observable */\nexport function delayResponse<T>(response$: Observable<T>, delayMs: number): Observable<T> {\n return new Observable<T>(observer => {\n let completePending = false;\n let nextPending = false;\n const subscription = response$.subscribe(\n value => {\n nextPending = true;\n setTimeout(() => {\n observer.next(value);\n if (completePending) {\n observer.complete();\n }\n }, delayMs);\n },\n error => setTimeout(() => observer.error(error), delayMs),\n () => {\n completePending = true;\n if (!nextPending) {\n observer.complete();\n }\n }\n );\n return () => {\n return subscription.unsubscribe();\n };\n });\n}\n"]}