codecamp

RxJS ConnectableObservable

class ConnectableObservable<T> extends Observable {
  constructor(source: Observable<T>, subjectFactory: () => Subject<T>)
  protected _subject: Subject<T>
  protected _refCount: number
  protected _connection: Subscription
  source: Observable<T>
  protected subjectFactory: () => Subject<T>
  _subscribe(subscriber: Subscriber<T>)
  protected getSubject(): Subject<T>
  connect(): Subscription
  refCount(): Observable<T>

 
  // inherited from index/Observable
  static create: Function
  static if: typeof iif
  static throw: typeof throwError
  constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic)
  _isScalar: boolean
  source: Observable<any>
  operator: Operator<any, T>
  lift<R>(operator: Operator<T, R>): Observable<R>
  subscribe(observerOrNext?: NextObserver<T> | ErrorObserver<T> | CompletionObserver<T> | ((value: T) => void), error?: (error: any) => void, complete?: () => void): Subscription
  _trySubscribe(sink: Subscriber<T>): TeardownLogic
  forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise<void>
  pipe(...operations: OperatorFunction<any, any>[]): Observable<any>
  toPromise(promiseCtor?: PromiseConstructorLike): Promise<T>
}

建设者

constructor(source: Observable<T>, subjectFactory: () => Subject<T>)`

参量: 类型:
资源 类型:Observable
subjectFactory 类型:。`() => Subject

物产

属性 类型 描述
_学科 Subject<T>
_refCount number
_连接 Subscription
资源 Observable<T> 在构造函数中声明。
subjectFactory () => Subject<T> 在构造函数中声明。

方法

_订阅() _subscribe(subscriber: Subscriber<T>)

参量: 类型:
订户 类型:。Subscriber

getSubject()
protected getSubject(): Subject<T>参量没有参数。退货Subject<T>

connect()
connect(): Subscription参量没有参数。退货Subscription

refCount()
refCount(): Observable<T>参量没有参数。退货Observable<T>
RxJS config
RxJS defer
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

RxJS operators

RxJS fetch

RxJS testing

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }