1 line
3.3 KiB
Plaintext
1 line
3.3 KiB
Plaintext
|
{"version":3,"file":"dematerialize.js","sourceRoot":"","sources":["../../src/operators/dematerialize.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAI3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH;IACE,MAAM,CAAC,uCAAuC,MAAmC;QAC/E,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC;AAJe,qBAAa,gBAI5B,CAAA;AAED;IAAA;IAIA,CAAC;IAHC,oCAAI,GAAJ,UAAK,UAA2B,EAAE,MAAW;QAC3C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,uBAAuB,CAAC,UAAU,CAAC,CAAC,CAAC;IACnE,CAAC;IACH,4BAAC;AAAD,CAAC,AAJD,IAIC;AAED;;;;GAIG;AACH;IAAmE,2CAAa;IAC9E,iCAAY,WAA4B;QACtC,kBAAM,WAAW,CAAC,CAAC;IACrB,CAAC;IAES,uCAAK,GAAf,UAAgB,KAAQ;QACtB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IACH,8BAAC;AAAD,CAAC,AARD,CAAmE,uBAAU,GAQ5E","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Notification } from '../Notification';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Converts an Observable of {@link Notification} objects into the emissions\n * that they represent.\n *\n * <span class=\"informal\">Unwraps {@link Notification} objects as actual `next`,\n * `error` and `complete` emissions. The opposite of {@link materialize}.</span>\n *\n * <img src=\"./img/dematerialize.png\" width=\"100%\">\n *\n * `dematerialize` is assumed to operate an Observable that only emits\n * {@link Notification} objects as `next` emissions, and does not emit any\n * `error`. Such Observable is the output of a `materialize` operation. Those\n * notifications are then unwrapped using the metadata they contain, and emitted\n * as `next`, `error`, and `complete` on the output Observable.\n *\n * Use this operator in conjunction with {@link materialize}.\n *\n * @example <caption>Convert an Observable of Notifications to an actual Observable</caption>\n * var notifA = new Rx.Notification('N', 'A');\n * var notifB = new Rx.Notification('N', 'B');\n * var notifE = new Rx.Notification('E', void 0,\n * new TypeError('x.toUpperCase is not a function')\n * );\n * var materialized = Rx.Observable.of(notifA, notifB, notifE);\n * var upperCase = materialized.dematerialize();\n * upperCase.subscribe(x => console.log(x), e => console.error(e));\n *\n * // Results in:\n * // A\n * // B\n * // TypeError: x.toUpperCase is not a function\n *\n * @see {@link Notification}\n * @see {@link materialize}\n *\n * @return {Observable} An Observable that emits items and notifications\n * embedded in Notification objects emitted by the source Observable.\n * @method dematerialize\n * @owner Observable\n */\nexport function dematerialize<T>(): OperatorFunction<Notification<T>, T> {\n return function dematerializeOperatorFunction(source: Observable<Notification<T>>) {\n return source.lift(new DeMaterializeOperator());\n };\n}\n\nclass DeMaterializeOperator<T extends Notification<any>, R> implements Operator<T, R> {\n call(subscriber: Subscriber<any>, source: any): any {\n return source.subscribe(new DeMaterializeSubscriber(subscriber));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass DeMaterializeSubscriber<T extends Notification<any>> extends Subscriber<T> {\n constructor(destination: Subscriber<any>) {\n super(destination);\n }\n\n protected _next(value: T) {\n value.observe(this.destination);\n }\n}\n"]}
|