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


TypeScript Subject.error方法代碼示例

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


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

示例1: doFileOperation

    /**
     * General method for performing the given operation (copy|move)
     *
     * @param action the action to perform (copy|move)
     * @param type type of the content (content|folder)
     * @param contentEntry the contentEntry which has to have the action performed on
     * @param permission permission which is needed to apply the action
     */
    private doFileOperation(action: string, type: string, contentEntry: MinimalNodeEntryEntity, permission?: string): Subject<string> {
        const observable: Subject<string> = new Subject<string>();

        if (this.contentService.hasPermission(contentEntry, permission)) {
            const data: ContentNodeSelectorComponentData = {
                title: `${action} ${contentEntry.name} to ...`,
                currentFolderId: contentEntry.parentId,
                rowFilter: this.rowFilter.bind(this, contentEntry.id),
                imageResolver: this.imageResolver.bind(this),
                select: new EventEmitter<MinimalNodeEntryEntity[]>()
            };

            this.dialog.open(ContentNodeSelectorComponent, { data, panelClass: 'adf-content-node-selector-dialog', width: '630px' });

            data.select.subscribe((selections: MinimalNodeEntryEntity[]) => {
                const selection = selections[0];
                this.documentListService[`${action}Node`].call(this.documentListService, contentEntry.id, selection.id)
                    .subscribe(
                        observable.next.bind(observable, `OPERATION.SUCCES.${type.toUpperCase()}.${action.toUpperCase()}`),
                        observable.error.bind(observable)
                    );
                this.dialog.closeAll();
            });

            return observable;
        } else {
            observable.error(new Error(JSON.stringify({ error: { statusCode: 403 } })));
            return observable;
        }
    }
開發者ID:gravitonian,項目名稱:alfresco-ng2-components,代碼行數:38,代碼來源:node-actions.service.ts

示例2: function

 geocoder.geocode(options, function (results, status) {
   if (status == google.maps.GeocoderStatus.OK) {
     geocode$.next(results);
   } else {
     geocode$.error(results);
   }
 });
開發者ID:ncwright,項目名稱:ng2-ui,代碼行數:7,代碼來源:geo-coder.ts

示例3: getCurrentPosition

  getCurrentPosition(geoLocationOptions?: IJson) : Observable<any> {
    geoLocationOptions = geoLocationOptions || { timeout: 5000 };
   
    let getCurrentPosition$ = new Subject();
   
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(
        function(position) {
          getCurrentPosition$.next(position);
        }, function(evt) {
          getCurrentPosition$.error(evt);
        },
        geoLocationOptions
      );
    } else {
      getCurrentPosition$.error("Browser Geolocation service failed.");
    }

    return getCurrentPosition$;
  };
開發者ID:ncwright,項目名稱:ng2-ui,代碼行數:20,代碼來源:navigator-geolocation.ts

示例4:

 err => {
   subject.error(err);
   subject.complete();
 }
開發者ID:gajaharan,項目名稱:ANDlinked4,代碼行數:4,代碼來源:user.service.ts

示例5: function

 }, function(evt) {
   getCurrentPosition$.error(evt);
 },
開發者ID:ncwright,項目名稱:ng2-ui,代碼行數:3,代碼來源:navigator-geolocation.ts

示例6:

 let callback = (error:any, response:any) => {
     if(error) subject$.error(error);
     subject$.next(response);
     subject$.complete();
 };
開發者ID:KenavR,項目名稱:deepstream-rx-client,代碼行數:5,代碼來源:ClientRecord.ts


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