How to use the brookjs.ofType function in brookjs

To help you get started, we’ve selected a few brookjs 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 mAAdhaTTah / brookjs / packages / brookjs-cli / src / deltas / testRunnerDelta / index.js View on Github external
export default R.curry((services, actions$, state$) =>
    state$.sampledBy(actions$.thru(ofType(READ_RC_FILE))).take(1)
        .filter(action => isTestCommand(action) || isDevCommand(action))
        .flatMap(state => {
            switch (getCommandType(state)) {
                case 'unit':
                case 'tdd':
                    return unitTestRunner(services, actions$, state$);
                default:
                    // @todo emit error
                    return Kefir.never();
            }
        })
);
github intraxia / wp-gistpen / client / deltas / search.js View on Github external
export default function searchDelta(actions$: Observable, state$: Observable): Observable {
    return state$.sampledBy(actions$.thru(ofType(searchInput)))
        .filter((state: TinyMCEState) => state.search.term)
        .flatMapLatest((state: TinyMCEState): Observable => ajax$(getSearchUrl(state), {
            method: 'GET',
            headers: {
                'X-WP-Nonce': state.globals.nonce
            }
        }))
        .flatMap((response: ObsResponse) => response.json())
        .map(searchResultsSucceeded);
}
github mAAdhaTTah / brookjs / packages / brookjs-cli / src / selectors / index.js View on Github external
export const takeStateOnBootstrap = (state$, actions$) =>
    state$.sampledBy(
        actions$.thru(ofType(READ_RC_FILE, READ_ENV, RUN))
            .bufferWithCount(3)
    ).take(1);
github mAAdhaTTah / brookjs / packages / brookjs-cli / src / deltas / terminalDelta / devCommand.js View on Github external
return state$.take(1).flatMap(state => {
        switch (R.view(lCommandTypeArg, state)) {
            case 'app':
                return actions$.thru(ofType(WEBPACK_COMPILED)).flatMap(({ payload }) =>
                    ui.log('info', payload.stats.toString({ colors: true }))
                );
            case 'tdd':
            default:
                return Kefir.never();
        }
    });
};
github intraxia / wp-gistpen / client / block / SetEmbed / Creating / View.tsx View on Github external
preplug={a$ =>
        a$
          .thru(ofType(wpActions.change))
          .map(action => createFilenameChange(action.payload.value))
      }
github intraxia / wp-gistpen / commands / E2ECommand.tsx View on Github external
(state): Observable => {
        const ret = toObs(state.e2e.startup?.())
          .map(msg => actions.startup.success({ msg }))
          .flatMapErrors(err => Kefir.constant(actions.startup.failure(err)));

        return state.e2e.shutdown == null
          ? ret.takeUntilBy(action$.thru(ofType(actions.shutdown.request)))
          : ret;
      }
    )

brookjs

reactive programming tools for well-structured, testable applications

MIT
Latest version published 5 years ago

Package Health Score

40 / 100
Full package analysis

Popular brookjs functions

Similar packages