当前位置: 首页>>代码示例>>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;未经允许,请勿转载。