How to use the @ngrx/effects.createEffect function in @ngrx/effects

To help you get started, we’ve selected a few @ngrx/effects examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vladimiry / ElectronMail / src / web / browser-window / app / _accounts / accounts.effects.ts View on Github external
);
                const ipcMainClient = this.api.ipcMainClient();
                const zoneName = logger.zoneName();
                let bootstrappedOnce = false;

                logger.info("setup");

                return merge(
                    of(ACCOUNTS_ACTIONS.Patch({login, patch: {syncingActivated: true}})),
                    this.store.pipe(
                        select(OptionsSelectors.FEATURED.mainProcessNotification),
                        filter(IPC_MAIN_API_NOTIFICATION_ACTIONS.is.DbPatchAccount),
                        filter(({payload: {key}}) => key.type === type && key.login === login),
                        mergeMap(({payload: {stat: {unread}}}) => of(ACCOUNTS_ACTIONS.Patch({login, patch: {notifications: {unread}}}))),
                    ),
                    createEffect(
                        () => this.actions$.pipe(
                            unionizeActionFilter(ACCOUNTS_ACTIONS.is.SelectMailOnline),
                            map(logActionTypeAndBoundLoggerWithActionType({_logger})),
                            filter(({payload: {pk: key}}) => key.type === type && key.login === login),
                            mergeMap(({payload: selectMailOnlineInput}) => concat(
                                of(ACCOUNTS_ACTIONS.PatchProgress({login, patch: {selectingMailOnline: true}})),
                                this.api.webViewClient(webView, type, {finishPromise}).pipe(
                                    mergeMap((webViewClient) => {
                                        const selectMailOnlineInput$ = from(
                                            webViewClient("selectMailOnline", {timeoutMs: ONE_SECOND_MS * 5})({
                                                ...selectMailOnlineInput,
                                                zoneName,
                                            }),
                                        );
                                        return selectMailOnlineInput$.pipe(
                                            mergeMap(() => EMPTY),