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


TypeScript Observable.concat方法代码示例

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


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

示例1: in

	in(contents): Observable<boolean> {
		const data = JSON.parse(contents);
		// const parsed = JSON.parse(contents);
		var parsed = [];

		// Save present state of Patients into Backup database
		this.store.dispatch(this.backupActions.save());

		// Full restore
		// parsed = data.full;
		parsed = data.updated;

		const __ = (name, action, db, method = 'init') => {
			return Observable.of(null).do(() => {
				db.upsert(parsed[name], (x) => {
					this.store.dispatch(action[method](db.data()));
					db.save();
				});
			});
		}

		const a = __('diary', this.diaryActions, DiaryDB);
		const b = __('messages', this.messagesActions, MessagesDB);
		const c = __('store', this.storeActions, StoreDB);
		const d = __('storeAction', this.storeActions, StoreActionDB, 'init_actions');
		const x = __('sessions', this.sessionsActions, SessionsDB);
		const y = __('payments', this.paymentsActions, PaymentsDB);
		const z = __('patients', this.patientsActions, PatientsDB);

		return Observable.concat(a, b, c, d, x, y, z)
			.map(() => true)
			.delay(1500)
	}
开发者ID:jogboms,项目名称:ClinicRegistry,代码行数:33,代码来源:backup.service.ts

示例2: constructor

  constructor(private zone: NgZone) {
    // Extract a typed version of navigator.serviceWorker.
    this.container = navigator['serviceWorker'] as ServiceWorkerContainer;

    // Final Observable that will always give back the current controlling worker,
    // and follow changes over time.
    this.controllingWorker = Observable
      // Combine current and future controllers.
      .concat(
        // Current controlling worker (if any).
        Observable.of(this.container.controller),
        // Future changes of the controlling worker.
        Observable
          // Track changes of the controlling worker via the controllerchange event.
          .fromEvent(this.container, 'controllerchange')
          // Read the new controller when it changes.
          .map(_ => this.container.controller)
      )
      // Cache the latest controller for immediate delivery.
      .cache(1);
    
    // To make one-off calls to the worker, awaitSingleControllingWorker waits for
    // a controlling worker to exist.
    this.awaitSingleControllingWorker = this
      .controllingWorker
      .filter(worker => !!worker)
      .take(1);

    // Setup the push Observable as a broadcast mechanism for push notifications.
    this.push = Observable
      .defer(() => this.send({cmd: 'push'}))
      .share();
  }
开发者ID:SuperSoe,项目名称:mobile-toolkit,代码行数:33,代码来源:comm.ts

示例3: switch

            .mergeMap(({type, payload})=> {
                switch (type) {
                    case SELECT_REDDIT:
                        return Observable.concat(
                            //isFetching true
                            Observable.of({type: LOADING}),

                            //wait 2 seconds
                            Observable.timer(2000),

                            //request posts
                            reddit.fetchPosts(payload)
                                .map((body)=>({
                                    type: RECEIVE_POSTS,
                                    payload: {reddit: payload, data: body.data}
                                })),

                            //isFetching false, change selected item
                            Observable.of({type: SELECTED_REDDIT, payload})
                        );

                    default:
                        return o$;
                }
            });
开发者ID:andreyZavrazhnov,项目名称:ngrx-examples,代码行数:25,代码来源:reddit.ts

示例4: it

        it('should emit values from sourceTwo after sourceOne when used as static method', () => {
            const sourceOne = Observable.of(1,2,3);
            const sourceTwo = Observable.of(4,5,6);
            const example = Observable.concat(sourceOne,sourceTwo);
            const values = {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6};
            const expected = '(abcdef|)';

            expectObservable(example).toBe(expected, values);
        });
开发者ID:andreyZavrazhnov,项目名称:learn-rxjs,代码行数:9,代码来源:concat-spec.ts

示例5: add

 public add(doc: any): Observable<FalcorJsonGraph.PathValue | FalcorJsonGraph.InvalidPath> {
   let obj: any = {
     _id: doc._id
   };
   this.options.fields.forEach((f: string): void => {
     obj[f] = doc[f];
   });
   return Observable.concat(
     this.put(obj),
     Observable.from([FalcorJsonGraph.pathInvalidation([this.options.indexKey])])
   );
 }
开发者ID:cdhgee,项目名称:investments,代码行数:12,代码来源:GenericModel.ts

示例6: initialize

 .flatMap(data =>
   Observable.concat(
     // Form needs to be initilized first with correct values else question inputs will be empty. TODO: find better solution.
     Observable.of(
       initialize('application', {
         characters: data.characters,
         questions: data.questions,
       }),
     ),
     Observable.of({
       type: GET_APPLICATION_TEMPLATE_SUCCESS,
       template: data,
     }),
   ),
开发者ID:WhateverSkynet,项目名称:nodebb-plugin-moonlight,代码行数:14,代码来源:application.ts

示例7:

let logStream = Observable.create(observer => {
  // Create the subject if it doesn't exist already.
  if (logSubject === null) {
    logSubject = new LiteSubject<LogEntry>();
  }

  // An Observable representing buffered messages. Initialized to empty.
  let buffered: Observable<LogEntry> = Observable.empty<LogEntry>();

  // If the buffer exists, make it Observable.
  if (logBuffer !== null) {
    buffered = Observable.from(logBuffer);
    logBuffer = null;
  }

  // Combine (possibly empty) buffered messages with the subject, and pipe them to the
  // subscriber.
  return buffered
    .concat(logSubject.observable)
    .subscribe(observer);
});
开发者ID:mgechev,项目名称:mobile-toolkit,代码行数:21,代码来源:logging.ts

示例8: copyExistingCacheOp

 const op: Operation = () => Observable
   .concat(
     copyExistingCacheOp(oldWorker, newWorker, url, cache)(),
     cacheFromNetworkOp(newWorker, url, cache)()
   )
   .take(1);
开发者ID:mgechev,项目名称:mobile-toolkit,代码行数:6,代码来源:common.ts


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