Пример #1
0
    onCacheSelect(cacheID) {
        if (cacheID < 0)
            return;

        if (this.loadedCaches[cacheID])
            return;

        return this.onCacheSelectSubcription = merge(
            timer(0, 1).pipe(
                take(1),
                tap(() => this.ConfigureState.dispatchAction({type: 'LOAD_CACHE', cacheID}))
            ),
            race(
                this.ConfigureState.actions$.pipe(
                    filter((a) => a.type === 'LOAD_CACHE_OK' && a.cache._id === cacheID),
                    pluck('cache'),
                    tap((cache) => {
                        this.loadedCaches[cacheID] = cache;
                    })
                ),
                this.ConfigureState.actions$.pipe(
                    filter((a) => a.type === 'LOAD_CACHE_ERR' && a.action.cacheID === cacheID)
                )
            ).pipe(take(1))
        )
        .subscribe();
    }
 return (err, caught) =>
   Rx.concat(
     Rx.of({
       state: 'red',
       message: err.message
     }),
     Rx.timer(calculateDuration(++i)).pipe(mergeMap(() => caught))
   );
Пример #3
0
    _whenBaseLayerIsLoaded() {

      if (!this._baseLayerConfigured()) {
        return true;
      }

      const maxTimeForBaseLayer = 10000;
      const interval$ = Rx.interval(10).pipe(filter(() => !this._baseLayerDirty));
      const timer$ = Rx.timer(maxTimeForBaseLayer);

      return Rx.race(interval$, timer$).pipe(first()).toPromise();

    }
function runTargetSpec(host, targetSpec, overrides = {}, timeout = exports.DefaultTimeout, logger = new core_1.logging.NullLogger()) {
    targetSpec = Object.assign({}, targetSpec, { overrides });
    const workspaceFile = core_1.normalize('angular.json');
    const workspace = new core_1.experimental.workspace.Workspace(host.root(), host);
    // Emit when runArchitect$ completes or errors.
    // TODO: There must be a better way of doing this...
    let finalizeCB = () => { };
    const runArchitectFinalize$ = new rxjs_1.Observable(obs => {
        finalizeCB = () => obs.next();
    });
    // Load the workspace from the root of the host, then run a target.
    const runArchitect$ = workspace.loadWorkspaceFromHost(workspaceFile).pipe(operators_1.concatMap(ws => new src_1.Architect(ws).loadArchitect()), operators_1.concatMap(arch => arch.run(arch.getBuilderConfiguration(targetSpec), { logger })), operators_1.finalize(() => finalizeCB()));
    // Error out after the timeout if runArchitect$ hasn't finalized.
    const timeout$ = rxjs_1.timer(timeout).pipe(operators_1.takeUntil(runArchitectFinalize$), operators_1.concatMapTo(rxjs_1.throwError(`runTargetSpec timeout (${timeout}) reached.`)));
    return rxjs_1.merge(timeout$, runArchitect$);
}
Пример #5
0
 TimerObservable.create = function (initialDelay, period, scheduler) {
     if (initialDelay === void 0) { initialDelay = 0; }
     return rxjs_1.timer(initialDelay, period, scheduler);
 };
Пример #6
0
function pollStream(interval, stream) {
  return timer(0, interval).pipe(exhaustMap(() => stream));
}