@cerebral/fluent
Advanced tools
Comparing version 1.0.0-1518516413042 to 1.0.0-1518524980837
@@ -1,3 +0,10 @@ | ||
import { autorun } from 'mobx'; | ||
import { Reaction } from 'mobx'; | ||
import { getChangedProps, throwError, isObject, noop } from 'cerebral/internal'; | ||
function autorun(view) { | ||
const reaction = new Reaction(view.name || 'Autorun', function () { | ||
this.track(view); | ||
}); | ||
reaction.runReaction(); | ||
return reaction.getDisposer(); | ||
} | ||
class View { | ||
@@ -25,7 +32,9 @@ constructor({ dependencies, props, controller, displayName, onUpdate }) { | ||
registerAutorun() { | ||
console.log(this._displayName, 'starting autorun!'); | ||
this.autorun = autorun(() => { | ||
console.log(this._displayName, 'autorun!'); | ||
this.cerebralProps = this.dependencies({ | ||
state: this.controller.state, | ||
signals: this.controller.signals, | ||
props: this.props, | ||
props: this.props | ||
}); | ||
@@ -38,2 +47,3 @@ if (this.isMounted) { | ||
mount() { | ||
console.log(this._displayName, 'MOUNTING!'); | ||
this.registerAutorun(); | ||
@@ -78,4 +88,3 @@ this.isMounted = true; | ||
!this._hasWarnedBigComponent && | ||
Object.keys(dependenciesProps).length >= | ||
this.controller.devtools.bigComponentsWarning) { | ||
Object.keys(dependenciesProps).length >= this.controller.devtools.bigComponentsWarning) { | ||
console.warn(`Component named ${this | ||
@@ -82,0 +91,0 @@ ._displayName} has a lot of dependencies, consider refactoring or adjust this option in devtools`); |
{ | ||
"name": "@cerebral/fluent", | ||
"version": "1.0.0-1518516413042", | ||
"version": "1.0.0-1518524980837", | ||
"description": "Makes Cerebral typescript friendly", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"cerebral": "^4.2.0-1518516413042", | ||
"cerebral": "^4.2.0-1518524980837", | ||
"mobx": "^3.4.1" | ||
@@ -30,0 +30,0 @@ }, |
60429
1473