Subtheme of barrio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
6.1 KiB

{"version":3,"file":"subscribeToResult.js","sourceRoot":"","sources":["../../src/util/subscribeToResult.ts"],"names":[],"mappings":";AAAA,qBAAqB,QAAQ,CAAC,CAAA;AAC9B,4BAA4B,eAAe,CAAC,CAAA;AAC5C,0BAA0B,aAAa,CAAC,CAAA;AACxC,yBAAyB,YAAY,CAAC,CAAA;AAEtC,2BAA4C,eAAe,CAAC,CAAA;AAC5D,yBAA4C,oBAAoB,CAAC,CAAA;AAEjE,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,2BAAgD,sBAAsB,CAAC,CAAA;AAMvE,2BAAqC,eAA0C,EAC1C,MAA0B,EAC1B,UAAc,EACd,UAAmB;IACtD,IAAI,WAAW,GAAoB,IAAI,iCAAe,CAAC,eAAe,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAEhG,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,EAAE,CAAC,CAAC,MAAM,YAAY,uBAAU,CAAC,CAAC,CAAC;QACjC,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;YACrB,WAAW,CAAC,IAAI,CAAO,MAAO,CAAC,KAAK,CAAC,CAAC;YACtC,WAAW,CAAC,QAAQ,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC;QACd,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,WAAW,CAAC,kBAAkB,GAAG,IAAI,CAAC;YACtC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yBAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC/B,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EA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AC,QAAQ,EAAE,CAAC;gBACvB,KAAK,CAAC;YACR,CAAC;YACD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;gBACvB,KAAK,CAAC;YACR,CAAC;QACH,CAAC,QAAQ,IAAI,EAAE;IACjB,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,uBAAiB,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;QACrE,IAAM,GAAG,GAAG,MAAM,CAAC,uBAAiB,CAAC,EAAE,CAAC;QACxC,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC;YACxC,WAAW,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,gEAAgE,CAAC,CAAC,CAAC;QACrG,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,iCAAe,CAAC,eAAe,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,IAAM,KAAK,GAAG,mBAAQ,CAAC,MAAM,CAAC,GAAG,mBAAmB,GAAG,MAAI,MAAM,MAAG,CAAC;QACrE,IAAM,GAAG,GAAG,mBAAgB,KAAK,mCAA+B;cAC5D,8DAA8D,CAAC;QACnE,WAAW,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,MAAM,CAAC,IAAI,CAAC;AACd,CAAC;AApEe,yBAAiB,oBAoEhC,CAAA","sourcesContent":["import { root } from './root';\nimport { isArrayLike } from './isArrayLike';\nimport { isPromise } from './isPromise';\nimport { isObject } from './isObject';\nimport { Subscriber } from '../Subscriber';\nimport { Observable, ObservableInput } from '../Observable';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { Subscription } from '../Subscription';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { observable as Symbol_observable } from '../symbol/observable';\n\nexport function subscribeToResult<T, R>(outerSubscriber: OuterSubscriber<T, R>,\n result: any,\n outerValue?: T,\n outerIndex?: number): Subscription;\nexport function subscribeToResult<T>(outerSubscriber: OuterSubscriber<any, any>,\n result: ObservableInput<T>,\n outerValue?: T,\n outerIndex?: number): Subscription {\n let destination: Subscriber<any> = new InnerSubscriber(outerSubscriber, outerValue, outerIndex);\n\n if (destination.closed) {\n return null;\n }\n\n if (result instanceof Observable) {\n if (result._isScalar) {\n destination.next((<any>result).value);\n destination.complete();\n return null;\n } else {\n destination.syncErrorThrowable = true;\n return result.subscribe(destination);\n }\n } else if (isArrayLike(result)) {\n for (let i = 0, len = result.length; i < len && !destination.closed; i++) {\n destination.next(result[i]);\n }\n if (!destination.closed) {\n destination.complete();\n }\n } else if (isPromise(result)) {\n result.then(\n (value) => {\n if (!destination.closed) {\n destination.next(<any>value);\n destination.complete();\n }\n },\n (err: any) => destination.error(err)\n )\n .then(null, (err: any) => {\n // Escaping the Promise trap: globally throw unhandled errors\n root.setTimeout(() => { throw err; });\n });\n return destination;\n } else if (result && typeof result[Symbol_iterator] === 'function') {\n const iterator = <any>result[Symbol_iterator]();\n do {\n let item = iterator.next();\n if (item.done) {\n destination.complete();\n break;\n }\n destination.next(item.value);\n if (destination.closed) {\n break;\n }\n } while (true);\n } else if (result && typeof result[Symbol_observable] === 'function') {\n const obs = result[Symbol_observable]();\n if (typeof obs.subscribe !== 'function') {\n destination.error(new TypeError('Provided object does not correctly implement Symbol.observable'));\n } else {\n return obs.subscribe(new InnerSubscriber(outerSubscriber, outerValue, outerIndex));\n }\n } else {\n const value = isObject(result) ? 'an invalid object' : `'${result}'`;\n const msg = `You provided ${value} where a stream was expected.`\n + ' You can provide an Observable, Promise, Array, or Iterable.';\n destination.error(new TypeError(msg));\n }\n return null;\n}\n"]}