How to use the cerebral.Module function in cerebral

To help you get started, we’ve selected a few cerebral 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 reportportal / service-ui / app / src / controller / modules / router / router.js View on Github external
* GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Report Portal.  If not, see .
 */

import { Module } from 'cerebral';
import Router from '@cerebral/router';
import changePage from './factories/changePage';
import notAutenticate from './factories/notAutenticate';
import autenticate from './factories/autenticate';
import initialData from './factories/initialData';
import loginPageDataLoad from './factories/loginPageDataLoad';
import registrationTokenData from './factories/registrationTokenData';

export const route = Module({
  state: {
    currentPage: '',
    pageParams: {},
  },
  signals: {
    loginRouted: initialData(notAutenticate(loginPageDataLoad(changePage('login')))),
    forgotPassRouted: initialData(notAutenticate(loginPageDataLoad(changePage('forgotPass')))),
    appRouted: initialData(autenticate(changePage('app'))),
    registrationRouted: registrationTokenData(changePage('registration')),
  },
});

export default Router({
  routes: [
    {
      path: '/',
github reportportal / service-ui / app / src / controller / controller.js View on Github external
import { Module, Controller } from 'cerebral';
import FormsProvider from '@cerebral/forms';
import HttpProvider from '@cerebral/http';
import NotificationProvider from './providers/notification';
import modules from './modules/modules';

const Devtools = (
    process.env.NODE_ENV === 'production' ? null : require('cerebral/devtools').default
);

const rootModule = Module({
  modules,
  providers: {
    forms: FormsProvider({}),
    http: HttpProvider({}),
    notification: NotificationProvider,
  },
  state: {
    hasLoadedInitialData: false,
    lang: 'en',
  },
  signals: {
  },
});

export default Controller(rootModule, {
  devtools: Devtools && Devtools({

cerebral

A state controller with its own debugger

MIT
Latest version published 5 years ago

Package Health Score

48 / 100
Full package analysis

Popular cerebral functions