1 line
20 KiB
JSON
1 line
20 KiB
JSON
{"id":"../node_modules/rxjs/_esm5/internal/observable/using.js","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/using.js.map","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/src/internal/observable/using.ts","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/package.json","includedInParent":true,"mtime":1545395695572},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/package.json","includedInParent":true,"mtime":1545395355370},{"name":"../Observable","loc":{"line":2,"column":27},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/using.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/Observable.js"},{"name":"./from","loc":{"line":3,"column":21},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/using.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/from.js"},{"name":"./empty","loc":{"line":4,"column":22},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/using.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/empty.js"}],"generated":{"js":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.using = using;\n\nvar _Observable = require(\"../Observable\");\n\nvar _from = require(\"./from\");\n\nvar _empty = require(\"./empty\");\n\n/** PURE_IMPORTS_START _Observable,_from,_empty PURE_IMPORTS_END */\nfunction using(resourceFactory, observableFactory) {\n return new _Observable.Observable(function (subscriber) {\n var resource;\n\n try {\n resource = resourceFactory();\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n\n var result;\n\n try {\n result = observableFactory(resource);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n\n var source = result ? (0, _from.from)(result) : _empty.EMPTY;\n var subscription = source.subscribe(subscriber);\n return function () {\n subscription.unsubscribe();\n\n if (resource) {\n resource.unsubscribe();\n }\n };\n });\n}","map":{"mappings":[{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":8,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":4,"column":0},"generated":{"line":10,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":34,"column":0},"generated":{"line":12,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":1,"column":0},"generated":{"line":14,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":2},"generated":{"line":15,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":13},"generated":{"line":15,"column":9}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":2},"generated":{"line":15,"column":14}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":13},"generated":{"line":15,"column":15}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":2},"generated":{"line":15,"column":30}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":27},"generated":{"line":15,"column":32}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":2},"generated":{"line":15,"column":49}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":36,"column":37},"generated":{"line":15,"column":51}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":4},"generated":{"line":16,"column":9}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":8},"generated":{"line":16,"column":13}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":4},"generated":{"line":16,"column":35}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":40},"generated":{"line":16,"column":36}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":40},"generated":{"line":16,"column":46}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":40},"generated":{"line":16,"column":56}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":40},"generated":{"line":16,"column":58}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":39,"column":4},"generated":{"line":17,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":39,"column":8},"generated":{"line":17,"column":8}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":39,"column":4},"generated":{"line":17,"column":16}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":40,"column":6},"generated":{"line":19,"column":8}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":41,"column":5},"generated":{"line":20,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":41,"column":5},"generated":{"line":20,"column":6}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":41,"column":5},"generated":{"line":20,"column":14}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":41,"column":5},"generated":{"line":20,"column":17}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":41,"column":5},"generated":{"line":20,"column":32}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":41,"column":5},"generated":{"line":20,"column":34}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":41,"column":6},"generated":{"line":21,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":42,"column":6},"generated":{"line":21,"column":13}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":42,"column":6},"generated":{"line":21,"column":18}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":43,"column":6},"generated":{"line":22,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":43,"column":6},"generated":{"line":22,"column":6}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":43,"column":13},"generated":{"line":22,"column":16}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":43,"column":13},"generated":{"line":22,"column":17}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":43,"column":6},"generated":{"line":22,"column":22}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":43,"column":23},"generated":{"line":22,"column":23}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":43,"column":6},"generated":{"line":22,"column":26}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":44,"column":5},"generated":{"line":23,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":44,"column":5},"generated":{"line":23,"column":13}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":44,"column":5},"generated":{"line":23,"column":22}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":46,"column":4},"generated":{"line":24,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":26,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":47,"column":8},"generated":{"line":26,"column":8}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":47,"column":4},"generated":{"line":26,"column":14}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":48,"column":6},"generated":{"line":28,"column":8}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":6}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":12}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":15}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":32}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":33}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":41}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":5},"generated":{"line":29,"column":42}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":49,"column":6},"generated":{"line":30,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":50,"column":6},"generated":{"line":30,"column":13}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":50,"column":6},"generated":{"line":30,"column":18}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":51,"column":6},"generated":{"line":31,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":51,"column":6},"generated":{"line":31,"column":6}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":51,"column":13},"generated":{"line":31,"column":16}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":51,"column":13},"generated":{"line":31,"column":17}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":51,"column":6},"generated":{"line":31,"column":22}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":51,"column":23},"generated":{"line":31,"column":23}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":51,"column":6},"generated":{"line":31,"column":26}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":52,"column":5},"generated":{"line":32,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":52,"column":5},"generated":{"line":32,"column":13}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":52,"column":5},"generated":{"line":32,"column":22}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":54,"column":4},"generated":{"line":33,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":4},"generated":{"line":35,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":10},"generated":{"line":35,"column":8}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":10},"generated":{"line":35,"column":14}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":10},"generated":{"line":35,"column":17}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":25},"generated":{"line":35,"column":23}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":25},"generated":{"line":35,"column":26}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":32},"generated":{"line":35,"column":42}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":25},"generated":{"line":35,"column":48}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":25},"generated":{"line":35,"column":49}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":42},"generated":{"line":35,"column":52}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":55,"column":4},"generated":{"line":35,"column":64}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":4},"generated":{"line":36,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":4},"generated":{"line":36,"column":8}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":11},"generated":{"line":36,"column":20}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":11},"generated":{"line":36,"column":23}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":11},"generated":{"line":36,"column":29}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":11},"generated":{"line":36,"column":30}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":11},"generated":{"line":36,"column":39}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":11},"generated":{"line":36,"column":40}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":11},"generated":{"line":36,"column":50}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":56,"column":4},"generated":{"line":36,"column":51}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":57,"column":6},"generated":{"line":37,"column":11}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":57,"column":19},"generated":{"line":37,"column":23}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":58,"column":6},"generated":{"line":38,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":58,"column":6},"generated":{"line":38,"column":6}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":58,"column":18},"generated":{"line":38,"column":18}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":58,"column":18},"generated":{"line":38,"column":19}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":58,"column":6},"generated":{"line":38,"column":30}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":59,"column":8},"generated":{"line":40,"column":10}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":59,"column":17},"generated":{"line":40,"column":20}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":60,"column":7},"generated":{"line":41,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":60,"column":7},"generated":{"line":41,"column":8}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":60,"column":7},"generated":{"line":41,"column":16}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":60,"column":7},"generated":{"line":41,"column":17}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":60,"column":7},"generated":{"line":41,"column":28}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":61,"column":6},"generated":{"line":42,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":62,"column":5},"generated":{"line":43,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":63,"column":1},"generated":{"line":44,"column":0}},{"source":"../../../src/internal/observable/using.ts","name":null,"original":{"line":37,"column":4},"generated":{"line":44,"column":3}}],"sources":{"../../../src/internal/observable/using.ts":"import { Observable } from '../Observable';\nimport { Unsubscribable, ObservableInput } from '../types';\nimport { from } from './from'; // from from from! LAWL\nimport { EMPTY } from './empty';\n\n/**\n * Creates an Observable that uses a resource which will be disposed at the same time as the Observable.\n *\n * <span class=\"informal\">Use it when you catch yourself cleaning up after an Observable.</span>\n *\n * `using` is a factory operator, which accepts two functions. First function returns a disposable resource.\n * It can be an arbitrary object that implements `unsubscribe` method. Second function will be injected with\n * that object and should return an Observable. That Observable can use resource object during its execution.\n * Both functions passed to `using` will be called every time someone subscribes - neither an Observable nor\n * resource object will be shared in any way between subscriptions.\n *\n * When Observable returned by `using` is subscribed, Observable returned from the second function will be subscribed\n * as well. All its notifications (nexted values, completion and error events) will be emitted unchanged by the output\n * Observable. If however someone unsubscribes from the Observable or source Observable completes or errors by itself,\n * the `unsubscribe` method on resource object will be called. This can be used to do any necessary clean up, which\n * otherwise would have to be handled by hand. Note that complete or error notifications are not emitted when someone\n * cancels subscription to an Observable via `unsubscribe`, so `using` can be used as a hook, allowing you to make\n * sure that all resources which need to exist during an Observable execution will be disposed at appropriate time.\n *\n * @see {@link defer}\n *\n * @param {function(): ISubscription} resourceFactory A function which creates any resource object\n * that implements `unsubscribe` method.\n * @param {function(resource: ISubscription): Observable<T>} observableFactory A function which\n * creates an Observable, that can use injected resource object.\n * @return {Observable<T>} An Observable that behaves the same as Observable returned by `observableFactory`, but\n * which - when completed, errored or unsubscribed - will also call `unsubscribe` on created resource object.\n */\nexport function using<T>(resourceFactory: () => Unsubscribable | void,\n observableFactory: (resource: Unsubscribable | void) => ObservableInput<T> | void): Observable<T> {\n return new Observable<T>(subscriber => {\n let resource: Unsubscribable | void;\n\n try {\n resource = resourceFactory();\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n\n let result: ObservableInput<T> | void;\n try {\n result = observableFactory(resource);\n } catch (err) {\n subscriber.error(err);\n return undefined;\n }\n\n const source = result ? from(result) : EMPTY;\n const subscription = source.subscribe(subscriber);\n return () => {\n subscription.unsubscribe();\n if (resource) {\n resource.unsubscribe();\n }\n };\n });\n}\n"},"lineCount":null}},"hash":"1928d75e46610137c35092f06c5a182f","cacheData":{"env":{}}} |