1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"ast":null,"code":"import { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function windowToggle(openings, closingSelector) {\n return source => source.lift(new WindowToggleOperator(openings, closingSelector));\n}\n\nclass WindowToggleOperator {\n constructor(openings, closingSelector) {\n this.openings = openings;\n this.closingSelector = closingSelector;\n }\n\n call(subscriber, source) {\n return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector));\n }\n\n}\n\nclass WindowToggleSubscriber extends OuterSubscriber {\n constructor(destination, openings, closingSelector) {\n super(destination);\n this.openings = openings;\n this.closingSelector = closingSelector;\n this.contexts = [];\n this.add(this.openSubscription = subscribeToResult(this, openings, openings));\n }\n\n _next(value) {\n const {\n contexts\n } = this;\n\n if (contexts) {\n const len = contexts.length;\n\n for (let i = 0; i < len; i++) {\n contexts[i].window.next(value);\n }\n }\n }\n\n _error(err) {\n const {\n contexts\n } = this;\n this.contexts = null;\n\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n\n while (++index < len) {\n const context = contexts[index];\n context.window.error(err);\n context.subscription.unsubscribe();\n }\n }\n\n super._error(err);\n }\n\n _complete() {\n const {\n contexts\n } = this;\n this.contexts = null;\n\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n\n while (++index < len) {\n const context = contexts[index];\n context.window.complete();\n context.subscription.unsubscribe();\n }\n }\n\n super._complete();\n }\n\n _unsubscribe() {\n const {\n contexts\n } = this;\n this.contexts = null;\n\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n\n while (++index < len) {\n const context = contexts[index];\n context.window.unsubscribe();\n context.subscription.unsubscribe();\n }\n }\n }\n\n notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n if (outerValue === this.openings) {\n let closingNotifier;\n\n try {\n const {\n closingSelector\n } = this;\n closingNotifier = closingSelector(innerValue);\n } catch (e) {\n return this.error(e);\n }\n\n const window = new Subject();\n const subscription = new Subscription();\n const context = {\n window,\n subscription\n };\n this.contexts.push(context);\n const innerSubscription = subscribeToResult(this, closingNotifier, context);\n\n if (innerSubscription.closed) {\n this.closeWindow(this.contexts.length - 1);\n } else {\n innerSubscription.context = context;\n subscription.add(innerSubscription);\n }\n\n this.destination.next(window);\n } else {\n this.closeWindow(this.contexts.indexOf(outerValue));\n }\n }\n\n notifyError(err) {\n this.error(err);\n }\n\n notifyComplete(inner) {\n if (inner !== this.openSubscription) {\n this.closeWindow(this.contexts.indexOf(inner.context));\n }\n }\n\n closeWindow(index) {\n if (index === -1) {\n return;\n }\n\n const {\n contexts\n } = this;\n const context = contexts[index];\n const {\n window,\n subscription\n } = context;\n contexts.splice(index, 1);\n window.complete();\n subscription.unsubscribe();\n }\n\n}","map":{"version":3,"names":["Subject","Subscription","OuterSubscriber","subscribeToResult","windowToggle","openings","closingSelector","source","lift","WindowToggleOperator","constructor","call","subscriber","subscribe","WindowToggleSubscriber","destination","contexts","add","openSubscription","_next","value","len","length","i","window","next","_error","err","index","context","error","subscription","unsubscribe","_complete","complete","_unsubscribe","notifyNext","outerValue","innerValue","outerIndex","innerIndex","innerSub","closingNotifier","e","push","innerSubscription","closed","closeWindow","indexOf","notifyError","notifyComplete","inner","splice"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/rxjs/_esm2015/internal/operators/windowToggle.js"],"sourcesContent":["import { Subject } from '../Subject';\nimport { Subscription } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function windowToggle(openings, closingSelector) {\n return (source) => source.lift(new WindowToggleOperator(openings, closingSelector));\n}\nclass WindowToggleOperator {\n constructor(openings, closingSelector) {\n this.openings = openings;\n this.closingSelector = closingSelector;\n }\n call(subscriber, source) {\n return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector));\n }\n}\nclass WindowToggleSubscriber extends OuterSubscriber {\n constructor(destination, openings, closingSelector) {\n super(destination);\n this.openings = openings;\n this.closingSelector = closingSelector;\n this.contexts = [];\n this.add(this.openSubscription = subscribeToResult(this, openings, openings));\n }\n _next(value) {\n const { contexts } = this;\n if (contexts) {\n const len = contexts.length;\n for (let i = 0; i < len; i++) {\n contexts[i].window.next(value);\n }\n }\n }\n _error(err) {\n const { contexts } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.error(err);\n context.subscription.unsubscribe();\n }\n }\n super._error(err);\n }\n _complete() {\n const { contexts } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.complete();\n context.subscription.unsubscribe();\n }\n }\n super._complete();\n }\n _unsubscribe() {\n const { contexts } = this;\n this.contexts = null;\n if (contexts) {\n const len = contexts.length;\n let index = -1;\n while (++index < len) {\n const context = contexts[index];\n context.window.unsubscribe();\n context.subscription.unsubscribe();\n }\n }\n }\n notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n if (outerValue === this.openings) {\n let closingNotifier;\n try {\n const { closingSelector } = this;\n closingNotifier = closingSelector(innerValue);\n }\n catch (e) {\n return this.error(e);\n }\n const window = new Subject();\n const subscription = new Subscription();\n const context = { window, subscription };\n this.contexts.push(context);\n const innerSubscription = subscribeToResult(this, closingNotifier, context);\n if (innerSubscription.closed) {\n this.closeWindow(this.contexts.length - 1);\n }\n else {\n innerSubscription.context = context;\n subscription.add(innerSubscription);\n }\n this.destination.next(window);\n }\n else {\n this.closeWindow(this.contexts.indexOf(outerValue));\n }\n }\n notifyError(err) {\n this.error(err);\n }\n notifyComplete(inner) {\n if (inner !== this.openSubscription) {\n this.closeWindow(this.contexts.indexOf(inner.context));\n }\n }\n closeWindow(index) {\n if (index === -1) {\n return;\n }\n const { contexts } = this;\n const context = contexts[index];\n const { window, subscription } = context;\n contexts.splice(index, 1);\n window.complete();\n subscription.unsubscrib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