Home Manual Reference Source Test Repository

es6/operator/subscribeOn.js

import { SubscribeOnObservable } from '../observable/SubscribeOnObservable';
/**
 * 使用指定的 IScheduler 异步地订阅此 Observable 的观察者。
 *
 * <img src="./img/subscribeOn.png" width="100%">
 *
 * @param {Scheduler} scheduler - 执行 subscription 操作的 IScheduler 。
 * @return {Observable<T>} 修改过的源 Observable 以便它的 subscriptions 发生在指定的 IScheduler 上。
 .
 * @method subscribeOn
 * @owner Observable
 */
export function subscribeOn(scheduler, delay = 0) {
    return this.lift(new SubscribeOnOperator(scheduler, delay));
}
class SubscribeOnOperator {
    constructor(scheduler, delay) {
        this.scheduler = scheduler;
        this.delay = delay;
    }
    call(subscriber, source) {
        return new SubscribeOnObservable(source, this.delay, this.scheduler).subscribe(subscriber);
    }
}
//# sourceMappingURL=subscribeOn.js.map