Installations
npm install cerebral-mobx
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
6.11.2
NPM Version
3.10.10
Releases
Release v2025-02-27_0058
Updated on Feb 27, 2025
release_2020-03-21_1721
Updated on Mar 21, 2020
release_2019-10-10_1642
Updated on Oct 10, 2019
release_2019-05-18_1030
Updated on May 18, 2019
release_2019-02-24_1519
Updated on Feb 24, 2019
release_2019-02-24_1445
Updated on Feb 24, 2019
Contributors
Unable to fetch Contributors
Languages
JavaScript (73.08%)
CSS (24.6%)
HTML (2.03%)
Shell (0.29%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
Download Statistics
Total Downloads
1,067
Last Day
1
Last Week
1
Last Month
12
Last Year
84
GitHub Statistics
MIT License
1,995 Stars
2,251 Commits
125 Forks
44 Watchers
18 Branches
78 Contributors
Updated on Mar 03, 2025
Bundle Size
5.38 kB
Minified
1.96 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.0
Package Id
cerebral-mobx@1.1.0
Size
20.97 kB
NPM Version
3.10.10
Node Version
6.11.2
Total Downloads
Cumulative downloads
Total Downloads
1,067
Last Day
0%
1
Compared to previous day
Last Week
0%
1
Compared to previous week
Last Month
-36.8%
12
Compared to previous month
Last Year
-20.8%
84
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
3
Dev Dependencies
1
cerebral-mobx
Combine Cerebral with Mobx state-tree.
State and model
With Mobx state tree you also define models, in addition to state. You do this directly in your modules:
modules/app.js
1import { types } from 'mobx-state-tree' 2import {set} from 'cerebral/operators' 3import {state, props} from 'cerebral/tags' 4 5const Box = types.model('Box', { 6 id: types.identifier(), 7 name: '', 8 x: 0, 9 y: 0, 10 get width() { 11 return this.name.length * 15 12 } 13}) 14 15export default { 16 model: { 17 boxes: types.map(Box), 18 selection: types.reference(Box) 19 }, 20 state: { 21 boxes: {}, 22 selection: null 23 }, 24 signals: { 25 boxSelected: set(state`app.selection`, state`app.boxes.${props`boxKey`}`) 26 } 27}
Instantiate
Instead of creating the controller from cerebral
, you create it from this package:
1import {Controller} from 'cerebral-mobx' 2import app from './modules/app' 3 4export default Controller({ 5 modules: {app} 6 // Other config options are the same 7})
Accessing state and props in components
For example using React you will need the package mobx-react and use the provide() method of the controller:
main.js
1import React from 'react' 2import {render} from 'react-dom' 3import controller from './controller' 4import {Provider} from 'mobx-react' 5import App from './components/App' 6 7render(( 8 <Provider {...controller.provide()}> 9 <App /> 10 </Provider> 11))
App.js
1import React from 'react' 2import {observer, inject} from 'mobx-react' 3 4@observer 5@inject('store', 'signals') 6class App extends React.Component { 7 renderBoxes () { 8 const {store, signals} = this.props 9 10 return Object.keys(store.app.boxes).map((boxKey) => { 11 return ( 12 <li onClick={() => signals.app.boxSelected({boxKey})}> 13 {store.app.boxes[boxKey].name} 14 </li> 15 ) 16 }) 17 } 18 render () { 19 const {store} = this.props 20 21 return ( 22 <div> 23 <h1>{store.app.selection && store.app.selection.name}</h1> 24 <ul> 25 {this.renderBoxes()} 26 </ul> 27 </div> 28 ) 29 } 30} 31 32export default App

No vulnerabilities found.
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/release.yml/next?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/release.yml/next?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/release.yml/next?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/release.yml/next?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/test.yml/next?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/test.yml/next?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/website.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/website.yml/next?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/website.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/website.yml/next?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/website.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/website.yml/next?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/website.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/cerebral/cerebral/website.yml/next?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 4 third-party GitHubAction dependencies pinned
- Info: 3 out of 3 npmCommand dependencies pinned
Reason
8 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-c75v-2vq8-878f
- Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8
- Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6
- Warn: Project is vulnerable to: GHSA-xf5p-87ch-gxw2
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg
- Warn: Project is vulnerable to: GHSA-5j4c-8p2g-v4jx
Reason
dangerous workflow patterns detected
Details
- Warn: untrusted code checkout '${{ github.event.workflow_run.head_branch }}': .github/workflows/release.yml:16
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Warn: no topLevel permission defined: .github/workflows/website.yml:1
- Info: no jobLevel write permissions found
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
2.9
/10
Last Scanned on 2025-03-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More