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


TypeScript rxjs.Observable類代碼示例

本文整理匯總了TypeScript中rxjs.Observable的典型用法代碼示例。如果您正苦於以下問題:TypeScript Observable類的具體用法?TypeScript Observable怎麽用?TypeScript Observable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1:

 const project = (value: number, index: number) => Observable.from(Promise.reject('' + value + '-' + index));
開發者ID:jaychsu,項目名稱:RxJS,代碼行數:1,代碼來源:concatMap-spec.ts

示例2: handleObservableError

 protected handleObservableError(error: Response | any): Observable<any> {
     return Observable.throw(extractError(error));
 }
開發者ID:wpbarcelos,項目名稱:ionicfirebasechat,代碼行數:3,代碼來源:base.service.ts

示例3: function

 loadData: function(){
   return Observable.of({});
 },
開發者ID:GSA,項目名稱:sam-web-design-standards,代碼行數:3,代碼來源:baseexample.spec.ts

示例4: get

 get(url: string,
     options?: RequestOptionsArgs): Observable<Response> {
   return Observable.from([this.fakeResponse]);
 }
開發者ID:tessa3,項目名稱:uxgraph,代碼行數:4,代碼來源:fake-http.ts

示例5:

 /**
  * Make Cold observable to Hot observable
  * 
  * On caller function will not need to make ".subscribe(...)" to execute procedure
  * 
  * @param cold Observable
  */
 public static makeHot<T>(cold: Observable<T>) {
   const subject = new Subject<T>();
   cold.subscribe(subject);
   return new Observable<T>((observer: any) => subject.subscribe(observer));
 }
開發者ID:PoompisekK,項目名稱:myWork,代碼行數:12,代碼來源:rxjs.util.ts

示例6: publishAll

 private publishAll() {
   this.getAllSubject.next(
     Observable.fromPromise(this.db.getAll())
   )
 }
開發者ID:likr,項目名稱:interactive-sem,代碼行數:5,代碼來源:projects-repository.service.ts

示例7:

 .catch(() => {
     return Observable.throw(LoadError.createGeneralError());
 });
開發者ID:feibeck,項目名稱:fussi,代碼行數:3,代碼來源:point-log.service.ts

示例8: beforeEach

        beforeEach(() => {
            DevicesService.save.and.returnValue(Observable.of(sensorMock));
            DevicesService.update.and.returnValue(Observable.of(sensorMock));

            sut.sensor = sensorMock;
        });
開發者ID:garage-it,項目名稱:SmartHouse-frontend,代碼行數:6,代碼來源:device-details-page.component.test.ts

示例9: constructor

 */
import * as _ from 'lodash';
import { Observable, Subscription } from 'rxjs';
import { CommandType, IAtomNavigation, IImplementationProvider, IImplementationService, Implementation, Reference, navigationHasRange } from 'atom-languageservices';
import { alias, injectable } from 'atom-languageservices/decorators';
import { readFile } from 'fs';
import { ProviderServiceBase } from './_ProviderServiceBase';
import { atomConfig } from '../decorators';
import { AtomCommands } from './AtomCommands';
import { AtomNavigation } from './AtomNavigation';
import { AtomTextEditorSource } from './AtomTextEditorSource';
import { CommandsService } from './CommandsService';
import { ReferenceView } from './views/ReferenceView';
type Location = IAtomNavigation.Location;

const readFile$ = Observable.bindNodeCallback(readFile);
@injectable
@alias(IImplementationService)
@atomConfig({
    default: true,
    description: 'Adds support for navigate to implementation or implementations'
})
export class ImplementationService
    extends ProviderServiceBase<IImplementationProvider, Implementation.IRequest, Observable<Location[]>, Observable<Location[]>>
    implements IImplementationService {
    private _navigation: AtomNavigation;
    private _commands: CommandsService;
    private _atomCommands: AtomCommands;
    private _source: AtomTextEditorSource;

    constructor(navigation: AtomNavigation, commands: CommandsService, atomCommands: AtomCommands, source: AtomTextEditorSource) {
開發者ID:OmniSharp,項目名稱:atom-languageclient,代碼行數:31,代碼來源:ImplementationService.ts


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