当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ReplaySubject.complete方法代码示例

本文整理汇总了TypeScript中rxjs.ReplaySubject.complete方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ReplaySubject.complete方法的具体用法?TypeScript ReplaySubject.complete怎么用?TypeScript ReplaySubject.complete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rxjs.ReplaySubject的用法示例。


在下文中一共展示了ReplaySubject.complete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

            (error: object, data: NpmRepositoryPackageJson) => {
            if (error) {
              subject.error(error);
            }

            subject.next(data);
            subject.complete();
          });
开发者ID:baconwaffles,项目名称:angular-cli,代码行数:8,代码来源:npm.ts

示例2: handleMessage

 handleMessage(msg: proto.Message) {
   if (msg.type) {
     switch (msg.type) {
       case 'offer':
         log.webrtc('REMOTE OFFER', { offer: msg.offer })
         this.pc
           .setRemoteDescription({ type: 'offer', sdp: msg.offer })
           .then(() =>
             this.candidates.subscribe((ic) =>
               this.pc
                 .addIceCandidate(ic)
                 .catch((err) => log.webrtc('Failed to addIceCandidate', err))
             )
           )
           .then(() => this.pc.createAnswer())
           .then((answer) => this.pc.setLocalDescription(answer))
           .then(() => {
             const { sdp } = this.pc.localDescription as RTCSessionDescription
             log.webrtc('Send LOCAL ANSWER', { answer: sdp })
             this.send({ answer: sdp })
             this.sdpIsSent()
           })
           .catch((err) => this._onError(err))
         break
       case 'answer':
         log.webrtc('REMOTE ANSWER is received', { answer: msg.answer })
         this.pc
           .setRemoteDescription({ type: 'answer', sdp: msg.answer } as any)
           .then(() => {
             this.candidates.subscribe((ic) =>
               this.pc
                 .addIceCandidate(ic)
                 .catch((err) => log.webrtc(`${this.id}: Failed to add REMOTE Ice Candidate`, err))
             )
           })
           .catch((err) => this._onError(err))
         break
       case 'candidate':
         log.webrtc('REMOTE ICE CANDIDATE is received', msg.candidate)
         this.candidates.next(new env.RTCIceCandidate(msg.candidate as proto.IceCandidate))
         break
       default:
         this._onError(new Error('Buffer Protocol unknown message from the remote peer'))
     }
   } else {
     log.webrtc('REMOTE FINAL MESSAGE received')
     this.finalMessageReceived = true
     this.candidates.complete()
     if (this.finalMessageSent) {
       this.remotes.delete(this.id)
     }
   }
 }
开发者ID:openpaas-ng,项目名称:netflux,代码行数:53,代码来源:Remote.ts

示例3: Date

 .subscribe(articles => {
     if (articleSubject.observers.length > 0) {
         articleSubject.next(articles);
         feed.lastUpdatedAt = new Date();
         setTimeout(
             () => this.fetchArticles(feed, articleSubject),
             600000,
         );
     } else {
         articleSubject.complete();
     }
 });
开发者ID:danhooper,项目名称:home_page,代码行数:12,代码来源:rss.service.ts

示例4: clean

 clean(sendFinalMessage = true) {
   log.webrtc('CLEAN REMOTE')
   this.pc.oniceconnectionstatechange = () => {}
   this.pc.onicecandidate = () => {}
   ;(this.pc as any).ondatachannel = () => {}
   this._onError = () => {}
   this.candidates.complete()
   this.remotes.delete(this.id)
   clearTimeout(this.timer)
   this.pc.close()
   if (sendFinalMessage) {
     this.sendFinalMessage()
   }
 }
开发者ID:openpaas-ng,项目名称:netflux,代码行数:14,代码来源:Remote.ts

示例5: getNpmConfigOption

function getNpmConfigOption(
  option: string,
  scope?: string,
  tryWithoutScope?: boolean,
): Observable<string | undefined> {
  if (scope && tryWithoutScope) {
    return concat(
      getNpmConfigOption(option, scope),
      getNpmConfigOption(option),
    ).pipe(
      filter(result => !!result),
      defaultIfEmpty(),
      first(),
    );
  }

  const fullOption = `${scope ? scope + ':' : ''}${option}`;

  let value = npmConfigOptionCache.get(fullOption);
  if (value) {
    return value;
  }

  const subject = new ReplaySubject<string | undefined>(1);

  try {
    exec(`npm get ${fullOption}`, (error, data) => {
      if (error) {
        subject.next();
      } else {
        data = data.trim();
        if (!data || data === 'undefined' || data === 'null') {
          subject.next();
        } else {
          subject.next(data);
        }
      }

      subject.complete();
    });
  } catch {
    subject.next();
    subject.complete();
  }

  value = subject.asObservable();
  npmConfigOptionCache.set(fullOption, value);

  return value;
}
开发者ID:fmalcher,项目名称:angular-cli,代码行数:50,代码来源:npm.ts

示例6: getNpmConfigOption

function getNpmConfigOption(
  option: string,
  scope?: string,
  tryWithoutScope?: boolean,
): Observable<string | undefined> {
  if (scope && tryWithoutScope) {
    return concat(
      getNpmConfigOption(option, scope),
      getNpmConfigOption(option),
    ).pipe(
      filter(result => !!result),
      defaultIfEmpty(),
      first(),
    );
  }

  const fullOption = `${scope ? scope + ':' : ''}${option}`;

  let value = npmConfigOptionCache.get(fullOption);
  if (value) {
    return value;
  }

  const subject = new ReplaySubject<string | undefined>(1);

  const optionValue = npmConfig && npmConfig[fullOption];
  if (optionValue == undefined || optionValue == null) {
    subject.next();
  } else {
    subject.next(optionValue);
  }

  subject.complete();

  value = subject.asObservable();
  npmConfigOptionCache.set(fullOption, value);

  return value;
}
开发者ID:rexebin,项目名称:angular-cli,代码行数:39,代码来源:npm.ts

示例7:

 Promise.all(promises).then(() => subject.complete());
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:1,代码来源:application.ts


注:本文中的rxjs.ReplaySubject.complete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。