ApplyRedirects.prototype.getChildConfig = function (injector, route) { var _this = this; if (route.children) { return of(new LoadedRouterConfig(route.children, injector, null)); } else if (route.loadChildren) { return mergeMap.call(runGuards(injector, route), function (shouldLoad) { if (shouldLoad) { if (route._loadedConfig) { return of(route._loadedConfig); } else { return map.call(_this.configLoader.load(injector, route.loadChildren), function (r) { route._loadedConfig = r; return r; }); } } else { return canLoadFails(route); } }); } else { return of(new LoadedRouterConfig([], injector, null)); } };
mergeMap(action => { if (action.type === EXECUTE_FOCUSED_CELL) { const state = store.getState(); const id = state.document.get("cellFocused"); if (!id) { throw new Error("attempted to execute without an id"); } return of(executeCell(id)); } return of(action); }),
.flatMap(res => concat( of(getEntriesSuccess( res.response, shouldRenderNewEntries( store.getState().pagination.page, store.getState().api.entries, store.getState().polling.entries, ), )), of(scrollToEntry(getScrollToId(res.response.entries, scrollTo))), ),
return (tree, context) => { const [yes, no] = static_1.partition(tree, predicate); if (!ruleNo) { // Shortcut. return call_1.callRule(ruleYes, of_1.of(static_1.partition(tree, predicate)[0]), context) .pipe(operators_1.map(yesTree => static_1.merge(yesTree, no, context.strategy))); } return call_1.callRule(ruleYes, of_1.of(yes), context) .pipe(operators_1.concatMap(yesTree => { return call_1.callRule(ruleNo, of_1.of(no), context) .pipe(operators_1.map(noTree => static_1.merge(yesTree, noTree, context.strategy))); })); };
return _this._loadSvgIconSetFromConfig(iconSetConfig).pipe(catchError(function (err) { var /** @type {?} */ url = _this._sanitizer.sanitize(SecurityContext.RESOURCE_URL, iconSetConfig.url); // Swallow errors fetching individual URLs so the combined Observable won't // necessarily fail. console.log("Loading icon set URL: " + url + " failed: " + err); return of(null); }), tap(function (svg) {
function updateMainEpic(actions, { getState }, { document }) { return of(document).pipe( filter(Boolean), switchMap(() => { const proxyLogger = new Subject(); const frameMain = createMainFramer(document, getState, proxyLogger); const buildAndFrameMain = actions.pipe( ofType( types.updateFile, types.executeChallenge, types.challengeMounted ), debounceTime(executeDebounceTimeout), switchMap(() => buildFromFiles(getState(), true).pipe( map(frameMain), ignoreElements(), catchError(err => of(disableJSOnError(err))) ) ) ); return merge(buildAndFrameMain, proxyLogger.map(updateConsole)); }) ); }
it("extracts all execution counts from a session", () => { return of( status("starting"), status("idle"), status("busy"), executeInput({ code: "display('woo')\ndisplay('hoo')", execution_count: 0 }), displayData({ data: { "text/plain": "woo" } }), displayData({ data: { "text/plain": "hoo" } }), executeInput({ code: "", execution_count: 1 }), status("idle") ) .pipe( executionCounts(), toArray() ) .toPromise() .then(arr => { expect(arr).toEqual([0, 1]); }); });
it("extracts outputs as nbformattable contents", () => { const hacking = of( status("busy"), displayData({ data: { "text/plain": "woo" } }), displayData({ data: { "text/plain": "hoo" } }), status("idle") ); return hacking .pipe( outputs(), toArray() ) .toPromise() .then(arr => { expect(arr).toEqual([ { data: { "text/plain": "woo" }, output_type: "display_data", metadata: {}, transient: {} }, { data: { "text/plain": "hoo" }, output_type: "display_data", metadata: {}, transient: {} } ]); }); });
.switchMap(({ page, hash }) => { /** * If there is a has in the url, we check that it is a number * and then we jump to the that entry. If the number isn't a valid * id of an entry the jumpToEvent api will return the first page. */ if (hash) { const id = hash.split('#')[1]; if (!isNaN(id)) return of(jumpToEvent(id)); } return getEntries(page, store.getState().config, store.getState().api.newestEntry) .timeout(10000) .map(res => getEntriesSuccess( res.response, shouldRenderNewEntries( store.getState().pagination.page, store.getState().api.entries, store.getState().polling.entries, ), ), ) .catch(error => of(getEntriesFailed(error))); });
function createUrlTree(urlTree, rootCandidate) { var root = rootCandidate.pathsWithParams.length > 0 ? new url_tree_1.UrlSegment([], (_a = {}, _a[shared_1.PRIMARY_OUTLET] = rootCandidate, _a)) : rootCandidate; return of_1.of(new url_tree_1.UrlTree(root, urlTree.queryParams, urlTree.fragment)); var _a; }
.call(catchOperator, function (err) { var /** @type {?} */ url = _this._sanitizer.sanitize(SecurityContext.RESOURCE_URL, iconSetConfig.url); // Swallow errors fetching individual URLs so the combined Observable won't // necessarily fail. console.log("Loading icon set URL: " + url + " failed: " + err); return of(null); })
/** * Set up a subscription for the data provided by the data source. * @return {?} */ _observeRenderChanges() { // If no data source has been set, there is nothing to observe for changes. if (!this.dataSource) { return; } let /** @type {?} */ dataStream; // Check if the datasource is a DataSource object by observing if it has a connect function. // Cannot check this.dataSource['connect'] due to potential property renaming, nor can it // checked as an instanceof DataSource<T> since the table should allow for data sources // that did not explicitly extend DataSource<T>. if ((/** @type {?} */ (this.dataSource)).connect instanceof Function) { dataStream = (/** @type {?} */ (this.dataSource)).connect(this); } else if (this.dataSource instanceof Observable) { dataStream = this.dataSource; } else if (Array.isArray(this.dataSource)) { dataStream = of(this.dataSource); } if (dataStream === undefined) { throw getTableUnknownDataSourceError(); } this._renderChangeSubscription = dataStream .pipe(takeUntil(this._onDestroy)) .subscribe(data => { this._data = data; this.renderRows(); }); }
function ViewportRuler(platform, ngZone) { var _this = this; this._change = platform.isBrowser ? ngZone.runOutsideAngular(function () { return merge(fromEvent(window, 'resize'), fromEvent(window, 'orientationchange')); }) : of(); this._invalidateCache = this.change().subscribe(function () { return _this._updateViewportSize(); }); }
catchError((error: Error) => of( actions.saveFailed({ error, contentRef: action.payload.contentRef }) )
switchMap(tests => { return from(tests).pipe( map(({ message }) => message), filter(overEvery(isString, Boolean)), map(updateConsole), concat(of(updateTests(tests))) ); }),
mergeMap((state: AppState) => { const content = selectors.content(state, { contentRef }); if (content) { return of(content); } else { return empty(); } })
.mergeMap(s => { if (s instanceof CanActivate) { return this.runResolve(s.route); } else { return of(null); } })
.mergeMap(shouldActivate => { if (shouldActivate) { return preActivation.resolveData().map(() => shouldActivate); } else { return of(shouldActivate); } })
var resolveData$ = mergeMap.call(preactivation2$, function (shouldActivate) { if (shouldActivate) { return map.call(preActivation.resolveData(), function () { return shouldActivate; }); } else { return of(shouldActivate); } });
function wrapIntoObservable(value) { if (value instanceof Observable_1.Observable) { return value; } else { return of_1.of(value); } }
.mergeMap(function (shouldActivate) { if (shouldActivate) { return preActivation.resolveData().map(function () { return shouldActivate; }); } else { return of_1.of(shouldActivate); } })
.mergeMap(function (s) { if (s instanceof CanActivate) { return _this.runResolve(s.route); } else { return of_1.of(null); } })
switchMap(({ payload }) => { const { languageInfo } = payload; return of( actions.setCodeMirrorMode( languageInfo.codemirror_mode || languageInfo.name || "" ) ); })
.mergeMap(() => concat$( of$(actions.requestArticleList()), fromPromise$(Articles.getList()) .map(actions.receiveArticleList) .catch(e => of$(actions.receiveArticleList(e)) ) ))
var runningChecks$ = mergeMap.call(checks$, function (s) { if (s instanceof CanActivate) { return _this.runResolve(s.route); } else { return of(null); } });
mergeMap(content => { if (content && content.type === "notebook") { // FIXME COME BACK TO HERE, we need to strip off the kernelRef const kernelRef = content.model.kernelRef; return of(content.model.kernelRef); } else { return empty(); } })
ApplyRedirects.prototype.expandWildCardWithParamsAgainstRouteUsingRedirect = function (route) { var newSegments = applyRedirectCommands([], route.redirectTo, {}); if (route.redirectTo.startsWith('/')) { return absoluteRedirect(newSegments); } else { return of(new UrlSegmentGroup(newSegments, {})); } };
catchError((xhrError: any) => of( actions.fetchContentFailed({ filepath: action.payload.filepath, error: xhrError, kernelRef: action.payload.kernelRef, contentRef: action.payload.contentRef }) )
static async getInitialProps ({ store, isServer }) { const resultAction = await rootEpic( of(actions.fetchCharacter(isServer)), store ).toPromise() // we need to convert Observable to Promise store.dispatch(resultAction) return { isServer } }
catchError((err: Error) => of( actions.fetchContentFailed({ filepath, error: err, kernelRef: action.payload.kernelRef, contentRef: action.payload.contentRef }) )