Sha256: b30a32557a40861c384f5a6a65113dbc89a4f9fedef79f88d8fba880018f7224

Contents?: true

Size: 1.32 KB

Versions: 49

Compression:

Stored size: 1.32 KB

Contents

import { Operator } from '../Operator';
import { IScheduler } from '../Scheduler';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { TeardownLogic } from '../Subscription';
import { SubscribeOnObservable } from '../observable/SubscribeOnObservable';
import { MonoTypeOperatorFunction } from '../interfaces';

/**
 * Asynchronously subscribes Observers to this Observable on the specified IScheduler.
 *
 * <img src="./img/subscribeOn.png" width="100%">
 *
 * @param {Scheduler} scheduler - The IScheduler to perform subscription actions on.
 * @return {Observable<T>} The source Observable modified so that its subscriptions happen on the specified IScheduler.
 .
 * @method subscribeOn
 * @owner Observable
 */
export function subscribeOn<T>(scheduler: IScheduler, 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: IScheduler,
              private delay: number) {
  }
  call(subscriber: Subscriber<T>, source: any): TeardownLogic {
    return new SubscribeOnObservable(
      source, this.delay, this.scheduler
    ).subscribe(subscriber);
  }
}

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
govuk_publishing_components-17.8.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.7.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.6.1 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.6.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.5.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.4.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.3.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.2.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.1.1 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.1.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-17.0.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.29.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.28.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.27.1 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.27.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.26.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.25.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.24.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.23.0 node_modules/rxjs/src/operators/subscribeOn.ts
govuk_publishing_components-16.22.0 node_modules/rxjs/src/operators/subscribeOn.ts