Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cerebral-modules

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cerebral-modules

A library for making modular cerebral apps

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

cerebral-modules

Create cerebral modules that can be reused, shared, imported or just simply keep your app tidy.

Creating a module

A module needs to export the following:

export default {
  name: 'uniqueModuleName',
  init(controller) {
    // register signals and do other module setup
  },
  routes(controller) {
    // return a cerebral-router route object that defines the routes for this module
  },
  Component: ModuleIndexComponent
}

Loading modules

From your main.js

// import your cerebral controller
import controller from './controller';

// import you app modules
import external form 'external-node-module';
import home from './modules/home';
import notFound from './modules/notFound';

// init the modules (this will also render the app)
import loadModules from 'cerebral-react-modules/load';
loadModules(controller, [ external, home, notFound ]);

Route Signals

In your module routing signals you need to specify which module should be rendered. This can be done using the setActiveModule action.

import setActiveModule from 'cerebral-react-modules/setActiveModule';

controller.signal('home.routed', [
  setActiveModule('home')
]);

Contribute

Fork repo

  • npm install
  • npm run dev runs dev mode which watches for changes and auto lints, tests and builds
  • npm test runs the tests
  • npm run lint lints the code
  • npm run build compiles es6 to es5

Keywords

FAQs

Package last updated on 25 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc