materialize.js.map 4.4 KB

1
  1. {"version":3,"file":"materialize.js","sourceRoot":"","sources":["../../src/operators/materialize.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAC3C,6BAA6B,iBAAiB,CAAC,CAAA;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IACE,MAAM,CAAC,qCAAqC,MAAqB;QAC/D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC;AAJe,mBAAW,cAI1B,CAAA;AAED;IAAA;IAIA,CAAC;IAHC,kCAAI,GAAJ,UAAK,UAAuC,EAAE,MAAW;QACvD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,CAAC;IACH,0BAAC;AAAD,CAAC,AAJD,IAIC;AAED;;;;GAIG;AACH;IAAuC,yCAAa;IAClD,+BAAY,WAAwC;QAClD,kBAAM,WAAW,CAAC,CAAC;IACrB,CAAC;IAES,qCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,2BAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;IAES,sCAAM,GAAhB,UAAiB,GAAQ;QACvB,IAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,WAAW,CAAC,IAAI,CAAC,2BAAY,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAChD,WAAW,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAES,yCAAS,GAAnB;QACE,IAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,WAAW,CAAC,IAAI,CAAC,2BAAY,CAAC,cAAc,EAAE,CAAC,CAAC;QAChD,WAAW,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IACH,4BAAC;AAAD,CAAC,AApBD,CAAuC,uBAAU,GAoBhD","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Notification } from '../Notification';\nimport { OperatorFunction } from '../interfaces';\n\n/**\n * Represents all of the notifications from the source Observable as `next`\n * emissions marked with their original types within {@link Notification}\n * objects.\n *\n * <span class=\"informal\">Wraps `next`, `error` and `complete` emissions in\n * {@link Notification} objects, emitted as `next` on the output Observable.\n * </span>\n *\n * <img src=\"./img/materialize.png\" width=\"100%\">\n *\n * `materialize` returns an Observable that emits a `next` notification for each\n * `next`, `error`, or `complete` emission of the source Observable. When the\n * source Observable emits `complete`, the output Observable will emit `next` as\n * a Notification of type \"complete\", and then it will emit `complete` as well.\n * When the source Observable emits `error`, the output will emit `next` as a\n * Notification of type \"error\", and then `complete`.\n *\n * This operator is useful for producing metadata of the source Observable, to\n * be consumed as `next` emissions. Use it in conjunction with\n * {@link dematerialize}.\n *\n * @example <caption>Convert a faulty Observable to an Observable of Notifications</caption>\n * var letters = Rx.Observable.of('a', 'b', 13, 'd');\n * var upperCase = letters.map(x => x.toUpperCase());\n * var materialized = upperCase.materialize();\n * materialized.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // - Notification {kind: \"N\", value: \"A\", error: undefined, hasValue: true}\n * // - Notification {kind: \"N\", value: \"B\", error: undefined, hasValue: true}\n * // - Notification {kind: \"E\", value: undefined, error: TypeError:\n * // x.toUpperCase is not a function at MapSubscriber.letters.map.x\n * // [as project] (http://1…, hasValue: false}\n *\n * @see {@link Notification}\n * @see {@link dematerialize}\n *\n * @return {Observable<Notification<T>>} An Observable that emits\n * {@link Notification} objects that wrap the original emissions from the source\n * Observable with metadata.\n * @method materialize\n * @owner Observable\n */\nexport function materialize<T>(): OperatorFunction<T, Notification<T>> {\n return function materializeOperatorFunction(source: Observable<T>) {\n return source.lift(new MaterializeOperator());\n };\n}\n\nclass MaterializeOperator<T> implements Operator<T, Notification<T>> {\n call(subscriber: Subscriber<Notification<T>>, source: any): any {\n return source.subscribe(new MaterializeSubscriber(subscriber));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass MaterializeSubscriber<T> extends Subscriber<T> {\n constructor(destination: Subscriber<Notification<T>>) {\n super(destination);\n }\n\n protected _next(value: T) {\n this.destination.next(Notification.createNext(value));\n }\n\n protected _error(err: any) {\n const destination = this.destination;\n destination.next(Notification.createError(err));\n destination.complete();\n }\n\n protected _complete() {\n const destination = this.destination;\n destination.next(Notification.createComplete());\n destination.complete();\n }\n}\n"]}