{"id":"lxDK","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/bindCallback.js.map","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/src/internal/observable/bindCallback.ts","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/package.json","includedInParent":true,"mtime":1545395749058},{"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/bindCallback.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/Observable.js"},{"name":"../AsyncSubject","loc":{"line":3,"column":29},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/bindCallback.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/AsyncSubject.js"},{"name":"../operators/map","loc":{"line":4,"column":20},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/bindCallback.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/map.js"},{"name":"../util/canReportError","loc":{"line":5,"column":31},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/bindCallback.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/util/canReportError.js"},{"name":"../util/isArray","loc":{"line":6,"column":24},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/bindCallback.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/util/isArray.js"},{"name":"../util/isScheduler","loc":{"line":7,"column":28},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/observable/bindCallback.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/util/isScheduler.js"}],"generated":{"js":"\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0}),exports.bindCallback=a;var r=require(\"../Observable\"),e=require(\"../AsyncSubject\"),t=require(\"../operators/map\"),c=require(\"../util/canReportError\"),n=require(\"../util/isArray\"),u=require(\"../util/isScheduler\");function a(s,o,l){if(o){if(!(0,u.isScheduler)(o))return function(){for(var r=[],e=0;e Observable;\n\nexport function bindCallback(callbackFunc: (callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): () => Observable;\nexport function bindCallback(callbackFunc: (callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): () => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): () => Observable;\nexport function bindCallback(callbackFunc: (callback: () => any) => any, scheduler?: SchedulerLike): () => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Observable;\n\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1, res2: R2, res3: R3, res4: R4, ...args: any[]) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1, res2: R2, res3: R3) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2, R3]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1, res2: R2) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable<[R1, R2]>;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (res1: R1) => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable;\nexport function bindCallback(callbackFunc: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: () => any) => any, scheduler?: SchedulerLike): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Observable;\n\nexport function bindCallback(callbackFunc: (...args: Array any)>) => any, scheduler?: SchedulerLike): (...args: A[]) => Observable;\nexport function bindCallback(callbackFunc: (...args: Array any)>) => any, scheduler?: SchedulerLike): (...args: A[]) => Observable;\n\nexport function bindCallback(callbackFunc: Function, scheduler?: SchedulerLike): (...args: any[]) => Observable;\n\n// tslint:enable:max-line-length\n\n/**\n * Converts a callback API to a function that returns an Observable.\n *\n * Give it a function `f` of type `f(x, callback)` and\n * it will return a function `g` that when called as `g(x)` will output an\n * Observable.\n *\n * `bindCallback` is not an operator because its input and output are not\n * Observables. The input is a function `func` with some parameters. The\n * last parameter must be a callback function that `func` calls when it is\n * done.\n *\n * The output of `bindCallback` is a function that takes the same parameters\n * as `func`, except the last one (the callback). When the output function\n * is called with arguments it will return an Observable. If function `func`\n * calls its callback with one argument, the Observable will emit that value.\n * If on the other hand the callback is called with multiple values the resulting\n * Observable will emit an array with said values as arguments.\n *\n * It is **very important** to remember that input function `func` is not called\n * when the output function is, but rather when the Observable returned by the output\n * function is subscribed. This means if `func` makes an AJAX request, that request\n * will be made every time someone subscribes to the resulting Observable, but not before.\n *\n * The last optional parameter - `scheduler` - can be used to control when the call\n * to `func` happens after someone subscribes to Observable, as well as when results\n * passed to callback will be emitted. By default, the subscription to an Observable calls `func`\n * synchronously, but using {@link asyncScheduler} as the last parameter will defer the call to `func`,\n * just like wrapping the call in `setTimeout` with a timeout of `0` would. If you were to use the async Scheduler\n * and call `subscribe` on the output Observable, all function calls that are currently executing\n * will end before `func` is invoked.\n *\n * By default, results passed to the callback are emitted immediately after `func` invokes the callback.\n * In particular, if the callback is called synchronously, then the subscription of the resulting Observable\n * will call the `next` function synchronously as well. If you want to defer that call,\n * you may use {@link asyncScheduler} just as before. This means that by using `Scheduler.async` you can\n * ensure that `func` always calls its callback asynchronously, thus avoiding terrifying Zalgo.\n *\n * Note that the Observable created by the output function will always emit a single value\n * and then complete immediately. If `func` calls the callback multiple times, values from subsequent\n * calls will not appear in the stream. If you need to listen for multiple calls,\n * you probably want to use {@link fromEvent} or {@link fromEventPattern} instead.\n *\n * If `func` depends on some context (`this` property) and is not already bound, the context of `func`\n * will be the context that the output function has at call time. In particular, if `func`\n * is called as a method of some objec and if `func` is not already bound, in order to preserve the context\n * it is recommended that the context of the output function is set to that object as well.\n *\n * If the input function calls its callback in the \"node style\" (i.e. first argument to callback is\n * optional error parameter signaling whether the call failed or not), {@link bindNodeCallback}\n * provides convenient error handling and probably is a better choice.\n * `bindCallback` will treat such functions the same as any other and error parameters\n * (whether passed or not) will always be interpreted as regular callback argument.\n *\n * ## Examples\n *\n * ### Convert jQuery's getJSON to an Observable API\n * ```javascript\n * // Suppose we have jQuery.getJSON('/my/url', callback)\n * const getJSONAsObservable = bindCallback(jQuery.getJSON);\n * const result = getJSONAsObservable('/my/url');\n * result.subscribe(x => console.log(x), e => console.error(e));\n * ```\n *\n * ### Receive an array of arguments passed to a callback\n * ```javascript\n * someFunction((a, b, c) => {\n * console.log(a); // 5\n * console.log(b); // 'some string'\n * console.log(c); // {someProperty: 'someValue'}\n * });\n *\n * const boundSomeFunction = bindCallback(someFunction);\n * boundSomeFunction().subscribe(values => {\n * console.log(values) // [5, 'some string', {someProperty: 'someValue'}]\n * });\n * ```\n *\n * ### Compare behaviour with and without async Scheduler\n * ```javascript\n * function iCallMyCallbackSynchronously(cb) {\n * cb();\n * }\n *\n * const boundSyncFn = bindCallback(iCallMyCallbackSynchronously);\n * const boundAsyncFn = bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async);\n *\n * boundSyncFn().subscribe(() => console.log('I was sync!'));\n * boundAsyncFn().subscribe(() => console.log('I was async!'));\n * console.log('This happened...');\n *\n * // Logs:\n * // I was sync!\n * // This happened...\n * // I was async!\n * ```\n *\n * ### Use bindCallback on an object method\n * ```javascript\n * const boundMethod = bindCallback(someObject.methodWithCallback);\n * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject\n * .subscribe(subscriber);\n * ```\n *\n * @see {@link bindNodeCallback}\n * @see {@link from}\n *\n * @param {function} func A function with a callback as the last parameter.\n * @param {SchedulerLike} [scheduler] The scheduler on which to schedule the\n * callbacks.\n * @return {function(...params: *): Observable} A function which returns the\n * Observable that delivers the same values the callback would deliver.\n * @name bindCallback\n */\nexport function bindCallback(\n callbackFunc: Function,\n resultSelector?: Function|SchedulerLike,\n scheduler?: SchedulerLike\n): (...args: any[]) => Observable {\n if (resultSelector) {\n if (isScheduler(resultSelector)) {\n scheduler = resultSelector;\n } else {\n // DEPRECATED PATH\n return (...args: any[]) => bindCallback(callbackFunc, scheduler)(...args).pipe(\n map((args) => isArray(args) ? resultSelector(...args) : resultSelector(args)),\n );\n }\n }\n\n return function (this: any, ...args: any[]): Observable {\n const context = this;\n let subject: AsyncSubject;\n const params = {\n context,\n subject,\n callbackFunc,\n scheduler,\n };\n return new Observable(subscriber => {\n if (!scheduler) {\n if (!subject) {\n subject = new AsyncSubject();\n const handler = (...innerArgs: any[]) => {\n subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);\n subject.complete();\n };\n\n try {\n callbackFunc.apply(context, [...args, handler]);\n } catch (err) {\n if (canReportError(subject)) {\n subject.error(err);\n } else {\n console.warn(err);\n }\n }\n }\n return subject.subscribe(subscriber);\n } else {\n const state: DispatchState = {\n args, subscriber, params,\n };\n return scheduler.schedule>(dispatch, 0, state);\n }\n });\n };\n}\n\ninterface DispatchState {\n args: any[];\n subscriber: Subscriber;\n params: ParamsContext;\n}\n\ninterface ParamsContext {\n callbackFunc: Function;\n scheduler: SchedulerLike;\n context: any;\n subject: AsyncSubject;\n}\n\nfunction dispatch(this: SchedulerAction>, state: DispatchState) {\n const self = this;\n const { args, subscriber, params } = state;\n const { callbackFunc, context, scheduler } = params;\n let { subject } = params;\n if (!subject) {\n subject = params.subject = new AsyncSubject();\n\n const handler = (...innerArgs: any[]) => {\n const value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;\n this.add(scheduler.schedule>(dispatchNext, 0, { value, subject }));\n };\n\n try {\n callbackFunc.apply(context, [...args, handler]);\n } catch (err) {\n subject.error(err);\n }\n }\n\n this.add(subject.subscribe(subscriber));\n}\n\ninterface NextState {\n subject: AsyncSubject;\n value: T;\n}\n\nfunction dispatchNext(this: SchedulerAction>, state: NextState) {\n const { value, subject } = state;\n subject.next(value);\n subject.complete();\n}\n\ninterface ErrorState {\n subject: AsyncSubject;\n err: any;\n}\n\nfunction dispatchError(this: SchedulerAction>, state: ErrorState) {\n const { err, subject } = state;\n subject.error(err);\n}\n"},"lineCount":null}},"hash":"de209d75a4334812778974e682378247","cacheData":{"env":{}}}