1 line
8.6 KiB
JSON
1 line
8.6 KiB
JSON
{"ast":null,"code":"import { async } from '../scheduler/async';\nimport { isDate } from '../util/isDate';\nimport { Subscriber } from '../Subscriber';\nimport { Notification } from '../Notification';\nexport function delay(delay, scheduler = async) {\n const absoluteDelay = isDate(delay);\n const delayFor = absoluteDelay ? +delay - scheduler.now() : Math.abs(delay);\n return source => source.lift(new DelayOperator(delayFor, scheduler));\n}\n\nclass DelayOperator {\n constructor(delay, scheduler) {\n this.delay = delay;\n this.scheduler = scheduler;\n }\n\n call(subscriber, source) {\n return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));\n }\n\n}\n\nclass DelaySubscriber extends Subscriber {\n constructor(destination, delay, scheduler) {\n super(destination);\n this.delay = delay;\n this.scheduler = scheduler;\n this.queue = [];\n this.active = false;\n this.errored = false;\n }\n\n static dispatch(state) {\n const source = state.source;\n const queue = source.queue;\n const scheduler = state.scheduler;\n const destination = state.destination;\n\n while (queue.length > 0 && queue[0].time - scheduler.now() <= 0) {\n queue.shift().notification.observe(destination);\n }\n\n if (queue.length > 0) {\n const delay = Math.max(0, queue[0].time - scheduler.now());\n this.schedule(state, delay);\n } else {\n this.unsubscribe();\n source.active = false;\n }\n }\n\n _schedule(scheduler) {\n this.active = true;\n const destination = this.destination;\n destination.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {\n source: this,\n destination: this.destination,\n scheduler: scheduler\n }));\n }\n\n scheduleNotification(notification) {\n if (this.errored === true) {\n return;\n }\n\n const scheduler = this.scheduler;\n const message = new DelayMessage(scheduler.now() + this.delay, notification);\n this.queue.push(message);\n\n if (this.active === false) {\n this._schedule(scheduler);\n }\n }\n\n _next(value) {\n this.scheduleNotification(Notification.createNext(value));\n }\n\n _error(err) {\n this.errored = true;\n this.queue = [];\n this.destination.error(err);\n this.unsubscribe();\n }\n\n _complete() {\n this.scheduleNotification(Notification.createComplete());\n this.unsubscribe();\n }\n\n}\n\nclass DelayMessage {\n constructor(time, notification) {\n this.time = time;\n this.notification = notification;\n }\n\n}","map":{"version":3,"names":["async","isDate","Subscriber","Notification","delay","scheduler","absoluteDelay","delayFor","now","Math","abs","source","lift","DelayOperator","constructor","call","subscriber","subscribe","DelaySubscriber","destination","queue","active","errored","dispatch","state","length","time","shift","notification","observe","max","schedule","unsubscribe","_schedule","add","scheduleNotification","message","DelayMessage","push","_next","value","createNext","_error","err","error","_complete","createComplete"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/rxjs/_esm2015/internal/operators/delay.js"],"sourcesContent":["import { async } from '../scheduler/async';\nimport { isDate } from '../util/isDate';\nimport { Subscriber } from '../Subscriber';\nimport { Notification } from '../Notification';\nexport function delay(delay, scheduler = async) {\n const absoluteDelay = isDate(delay);\n const delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);\n return (source) => source.lift(new DelayOperator(delayFor, scheduler));\n}\nclass DelayOperator {\n constructor(delay, scheduler) {\n this.delay = delay;\n this.scheduler = scheduler;\n }\n call(subscriber, source) {\n return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));\n }\n}\nclass DelaySubscriber extends Subscriber {\n constructor(destination, delay, scheduler) {\n super(destination);\n this.delay = delay;\n this.scheduler = scheduler;\n this.queue = [];\n this.active = false;\n this.errored = false;\n }\n static dispatch(state) {\n const source = state.source;\n const queue = source.queue;\n const scheduler = state.scheduler;\n const destination = state.destination;\n while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {\n queue.shift().notification.observe(destination);\n }\n if (queue.length > 0) {\n const delay = Math.max(0, queue[0].time - scheduler.now());\n this.schedule(state, delay);\n }\n else {\n this.unsubscribe();\n source.active = false;\n }\n }\n _schedule(scheduler) {\n this.active = true;\n const destination = this.destination;\n destination.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {\n source: this, destination: this.destination, scheduler: scheduler\n }));\n }\n scheduleNotification(notification) {\n if (this.errored === true) {\n return;\n }\n const scheduler = this.scheduler;\n const message = new DelayMessage(scheduler.now() + this.delay, notification);\n this.queue.push(message);\n if (this.active === false) {\n this._schedule(scheduler);\n }\n }\n _next(value) {\n this.scheduleNotification(Notification.createNext(value));\n }\n _error(err) {\n this.errored = true;\n this.queue = [];\n this.destination.error(err);\n this.unsubscribe();\n }\n _complete() {\n this.scheduleNotification(Notification.createComplete());\n this.unsubscribe();\n }\n}\nclass DelayMessage {\n constructor(time, notification) {\n this.time = time;\n this.notification = notification;\n }\n}\n"],"mappings":"AAAA,SAASA,KAAT,QAAsB,oBAAtB;AACA,SAASC,MAAT,QAAuB,gBAAvB;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,YAAT,QAA6B,iBAA7B;AACA,OAAO,SAASC,KAAT,CAAeA,KAAf,EAAsBC,SAAS,GAAGL,KAAlC,EAAyC;EAC5C,MAAMM,aAAa,GAAGL,MAAM,CAACG,KAAD,CAA5B;EACA,MAAMG,QAAQ,GAAGD,aAAa,GAAI,CAACF,KAAD,GAASC,SAAS,CAACG,GAAV,EAAb,GAAgCC,IAAI,CAACC,GAAL,CAASN,KAAT,CAA9D;EACA,OAAQO,MAAD,IAAYA,MAAM,CAACC,IAAP,CAAY,IAAIC,aAAJ,CAAkBN,QAAlB,EAA4BF,SAA5B,CAAZ,CAAnB;AACH;;AACD,MAAMQ,aAAN,CAAoB;EAChBC,WAAW,CAACV,KAAD,EAAQC,SAAR,EAAmB;IAC1B,KAAKD,KAAL,GAAaA,KAAb;IACA,KAAKC,SAAL,GAAiBA,SAAjB;EACH;;EACDU,IAAI,CAACC,UAAD,EAAaL,MAAb,EAAqB;IACrB,OAAOA,MAAM,CAACM,SAAP,CAAiB,IAAIC,eAAJ,CAAoBF,UAApB,EAAgC,KAAKZ,KAArC,EAA4C,KAAKC,SAAjD,CAAjB,CAAP;EACH;;AAPe;;AASpB,MAAMa,eAAN,SAA8BhB,UAA9B,CAAyC;EACrCY,WAAW,CAACK,WAAD,EAAcf,KAAd,EAAqBC,SAArB,EAAgC;IACvC,MAAMc,WAAN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