Gathering detailed insights and metrics for cerebral-mobx
Gathering detailed insights and metrics for cerebral-mobx
npm install cerebral-mobx
Typescript
Module System
Node Version
NPM Version
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
JavaScript (73.08%)
CSS (24.6%)
HTML (2.03%)
Shell (0.29%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
1,067
Last Day
1
Last Week
1
Last Month
12
Last Year
84
MIT License
1,995 Stars
2,251 Commits
125 Forks
44 Watchers
18 Branches
78 Contributors
Updated on Mar 03, 2025
Minified
Minified + Gzipped
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
Cumulative downloads
Total Downloads
3
1
Combine Cerebral with Mobx state-tree.
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}
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})
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
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
8 existing vulnerabilities detected
Details
Reason
dangerous workflow patterns detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
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
Reason
project is not fuzzed
Details
Score
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 MoreLast 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