PATH:
usr
/
local
/
lib
/
node_modules
/
ghost-cli
/
node_modules
/
rxjs
/
src
/
internal
/
operators
import { Operator } from '../Operator'; import { Subscriber } from '../Subscriber'; import { Observable } from '../Observable'; import { SubscribeOnObservable } from '../observable/SubscribeOnObservable'; import { MonoTypeOperatorFunction, SchedulerLike, TeardownLogic } from '../types'; /** * Asynchronously subscribes Observers to this Observable on the specified {@link SchedulerLike}. * * With `subscribeOn` you can decide what type of scheduler a specific Observable will be using when it is subscribed to. * * Schedulers control the speed and order of emissions to observers from an Observable stream. * *  * * ## Example * Given the following code: * ```javascript * import { of, merge } from 'rxjs'; * * const a = of(1, 2, 3, 4); * const b = of(5, 6, 7, 8, 9); * merge(a, b).subscribe(console.log); * ``` * * Both Observable `a` and `b` will emit their values directly and synchronously once they are subscribed to. * This will result in the output of `1 2 3 4 5 6 7 8 9`. * * But if we instead us the `subscribeOn` operator declaring that we want to use the {@link asyncScheduler} for values emited by Observable `a`: * ```javascript * import { of, merge, asyncScheduler } from 'rxjs'; * import { subscribeOn } from 'rxjs/operators'; * * const a = of(1, 2, 3, 4).pipe(subscribeOn(asyncScheduler)); * const b = of(5, 6, 7, 8, 9); * merge(a, b).subscribe(console.log); * ``` * * The output will instead be `5 6 7 8 9 1 2 3 4`. * The reason for this is that Observable `b` emits its values directly and synchronously like before * but the emissions from `a` are scheduled on the event loop because we are now using the {@link asyncScheduler} for that specific Observable. * * @param {SchedulerLike} scheduler - The {@link SchedulerLike} to perform subscription actions on. * @return {Observable<T>} The source Observable modified so that its subscriptions happen on the specified {@link SchedulerLike}. . * @method subscribeOn * @owner Observable */ export function subscribeOn<T>(scheduler: SchedulerLike, delay: number = 0): MonoTypeOperatorFunction<T> { return function subscribeOnOperatorFunction(source: Observable<T>): Observable<T> { return source.lift(new SubscribeOnOperator<T>(scheduler, delay)); }; } class SubscribeOnOperator<T> implements Operator<T, T> { constructor(private scheduler: SchedulerLike, private delay: number) { } call(subscriber: Subscriber<T>, source: any): TeardownLogic { return new SubscribeOnObservable<T>( source, this.delay, this.scheduler ).subscribe(subscriber); } }
[-] toArray.ts
[edit]
[-] window.ts
[edit]
[-] retry.ts
[edit]
[-] mergeAll.ts
[edit]
[-] windowWhen.ts
[edit]
[-] every.ts
[edit]
[-] timeout.ts
[edit]
[-] debounceTime.ts
[edit]
[-] index.ts
[edit]
[-] takeWhile.ts
[edit]
[-] audit.ts
[edit]
[-] reduce.ts
[edit]
[-] mapTo.ts
[edit]
[-] count.ts
[edit]
[-] debounce.ts
[edit]
[-] throwIfEmpty.ts
[edit]
[-] auditTime.ts
[edit]
[-] scan.ts
[edit]
[-] switchAll.ts
[edit]
[-] map.ts
[edit]
[-] bufferCount.ts
[edit]
[-] mergeScan.ts
[edit]
[-] publish.ts
[edit]
[-] min.ts
[edit]
[+]
..
[-] publishReplay.ts
[edit]
[-] bufferTime.ts
[edit]
[-] share.ts
[edit]
[-] repeat.ts
[edit]
[-] distinct.ts
[edit]
[-] concatMapTo.ts
[edit]
[-] buffer.ts
[edit]
[-] concatMap.ts
[edit]
[-] max.ts
[edit]
[-] partition.ts
[edit]
[-] observeOn.ts
[edit]
[-] bufferWhen.ts
[edit]
[-] dematerialize.ts
[edit]
[-] throttle.ts
[edit]
[-] groupBy.ts
[edit]
[-] withLatestFrom.ts
[edit]
[-] exhaust.ts
[edit]
[-] exhaustMap.ts
[edit]
[-] retryWhen.ts
[edit]
[-] zipAll.ts
[edit]
[-] find.ts
[edit]
[-] mergeMap.ts
[edit]
[-] single.ts
[edit]
[-] last.ts
[edit]
[-] combineLatest.ts
[edit]
[-] publishLast.ts
[edit]
[-] pluck.ts
[edit]
[-] pairwise.ts
[edit]
[-] distinctUntilChanged.ts
[edit]
[-] timeInterval.ts
[edit]
[-] shareReplay.ts
[edit]
[-] skipUntil.ts
[edit]
[-] findIndex.ts
[edit]
[-] windowToggle.ts
[edit]
[-] startWith.ts
[edit]
[-] timeoutWith.ts
[edit]
[-] concat.ts
[edit]
[-] materialize.ts
[edit]
[-] timestamp.ts
[edit]
[-] onErrorResumeNext.ts
[edit]
[-] subscribeOn.ts
[edit]
[-] takeUntil.ts
[edit]
[-] skipLast.ts
[edit]
[-] throttleTime.ts
[edit]
[-] mergeMapTo.ts
[edit]
[-] multicast.ts
[edit]
[-] merge.ts
[edit]
[-] takeLast.ts
[edit]
[-] delayWhen.ts
[edit]
[-] sampleTime.ts
[edit]
[-] tap.ts
[edit]
[-] take.ts
[edit]
[-] sample.ts
[edit]
[-] filter.ts
[edit]
[-] skip.ts
[edit]
[-] expand.ts
[edit]
[-] publishBehavior.ts
[edit]
[-] sequenceEqual.ts
[edit]
[-] ignoreElements.ts
[edit]
[-] catchError.ts
[edit]
[-] endWith.ts
[edit]
[-] refCount.ts
[edit]
[-] windowCount.ts
[edit]
[-] defaultIfEmpty.ts
[edit]
[-] windowTime.ts
[edit]
[-] switchMapTo.ts
[edit]
[-] switchMap.ts
[edit]
[-] delay.ts
[edit]
[-] bufferToggle.ts
[edit]
[-] repeatWhen.ts
[edit]
[-] concatAll.ts
[edit]
[-] first.ts
[edit]
[-] zip.ts
[edit]
[-] elementAt.ts
[edit]
[-] skipWhile.ts
[edit]
[-] race.ts
[edit]
[-] finalize.ts
[edit]
[-] combineAll.ts
[edit]
[-] distinctUntilKeyChanged.ts
[edit]
[-] isEmpty.ts
[edit]