當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Observer.complete方法代碼示例

本文整理匯總了TypeScript中rxjs/Rx.Observer.complete方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Observer.complete方法的具體用法?TypeScript Observer.complete怎麽用?TypeScript Observer.complete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rxjs/Rx.Observer的用法示例。


在下文中一共展示了Observer.complete方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 position => {
   const coordinate: Coordinate = {
     latitude: position.coords.latitude,
     longitude: position.coords.longitude
   };
   observer.next(coordinate);
   observer.complete();
 },
開發者ID:cristianrgreco,項目名稱:nearby-pokemon,代碼行數:8,代碼來源:location.service.ts

示例2:

 xhr.onreadystatechange = () => {
   if (xhr.readyState === 4) {
     if (xhr.status === 200) {
       observer.next("test");
       observer.complete();
     } else {
       observer.error(xhr.response);
     }
   }
 };
開發者ID:icebluetech,項目名稱:process-improvement-app,代碼行數:10,代碼來源:data.ts

示例3:

 let obs: Observable<any> = Observable.create((observer: Observer<any>) => {
   if (user.Email == "arun.thakur@mail.com" && user.Password == "123456") {
     observer.next(true);
   }
   else {
     observer.error("Invalid Credentials");
   }
   observer.complete();
   //return () => { console.log("disposable called..."); }; //dispose observable
 });
開發者ID:thakurarun,項目名稱:listit,代碼行數:10,代碼來源:userService.ts

示例4:

			}).then((cmpRef: ComponentRef<TooltipComponent>) => {
				// Store reference to TooltipComponent
				this._toolTipCmp = cmpRef;

				// Append it to DOM
				this.viewContainer.element.nativeElement.appendChild(cmpRef.location.nativeElement);

				// Resolve the component
				observer.next(this._toolTipCmp);
				observer.complete();
			});
開發者ID:cviccaro,項目名稱:jpa-admin,代碼行數:11,代碼來源:provider.ts

示例5: function

 req.onload = function() {
     if (req.status == 200) {
     // If the status is 200, meaning there have been no problems,
     // Yield the result to listeners and complete the sequence
         observer.next(req.response);
         observer.complete();
     }
     else {
     // Otherwise, signal to listeners that there has been an error
         observer.error(new Error(req.statusText));
     }
 };
開發者ID:MOHAMMADArsalan,項目名稱:learn-typed-rxjs,代碼行數:12,代碼來源:main.ts

示例6:

 (observer: Observer<any>) => {
   if (!this.needsUpdate(url)) {
     observer.next(this.cacheMap[url].data);
     observer.complete();
   }
   this.call("get", url).subscribe(
     res => {
       this.storeData(url, res.json());
       observer.next(this.cacheMap[url].data);
       observer.complete();
     }
   );
 }
開發者ID:audifaxdev,項目名稱:ng2-restservice,代碼行數:13,代碼來源:RestService.ts

示例7: Headers

        return Observable.create((observer: Observer<any>) => {
            if (this.authService.getToken() != null) {
                let headers = new Headers();
                headers.append('Authorization', `Bearer ${this.authService.getToken()}`);

                if (!pullRequest.merge_commit) {
                    observer.error(new Error('Impossible to get PR diff from the API'));
                    observer.complete();
                } else {
                    this.http.get(this.repoUrl + '/diff/' + pullRequest.merge_commit.hash, { headers: headers })
                    .subscribe(
                        (diffResponse: any) => {
                            observer.next(diffResponse._body);
                            observer.complete();
                        },
                        err => {
                            observer.error(err);
                        }
                    );
                }
            } else {
                observer.error('no token');
            }
        });
開發者ID:vnctaing,項目名稱:stethoscope,代碼行數:24,代碼來源:bitbucket.service.ts

示例8:

 let onLoad = (event) => {
   // console.log('xhr complete', event);
   responseObserver.complete();
 };
開發者ID:StudioProcess,項目名稱:imagetool,代碼行數:4,代碼來源:xhr-custom.ts

示例9: removeDomListener

 }, error => {
     observer.error(error);
     removeDomListener();
     observer.complete();
 }, options);
開發者ID:konstantindenerz,項目名稱:boardz-cross-platform-sample,代碼行數:5,代碼來源:mobileCameraService.ts


注:本文中的rxjs/Rx.Observer.complete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。