@cerebral/inferno
Advanced tools
Comparing version 4.0.0-1526409797341 to 4.0.0-1527015081471
@@ -47,10 +47,4 @@ import { InfernoChildren, VNode, Component } from 'inferno' | ||
// TODO: expose SignalsMap from cerebral | ||
interface SignalsMap { | ||
[signalName: string]: Sequence | ||
} | ||
export const Container: ComponentClass<{ app: BaseControllerClass }> | ||
export const StateContainer: ComponentClass<{ state: any; signals: SignalsMap }> | ||
export const Container: ComponentClass<{ controller: BaseControllerClass }> | ||
/* eslint-disable-next-line no-unused-vars */ | ||
@@ -57,0 +51,0 @@ type PropsMap<T> = { |
@@ -13,2 +13,4 @@ 'use strict'; | ||
var _internal = require('cerebral/internal'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -32,9 +34,16 @@ | ||
value: function getChildContext() { | ||
var controller = this.props.controller; | ||
var _props = this.props, | ||
app = _props.app, | ||
controller = _props.controller; | ||
if (!controller) { | ||
(0, _cerebral.throwError)('You are not passing controller to Container'); | ||
if (controller) { | ||
(0, _internal.DEPRECATE)('Container', 'please change from "controller" to "app" property'); | ||
} | ||
return { controller: controller }; | ||
if (!app && !controller) { | ||
(0, _cerebral.throwError)('You are not passing a Cerebral app to Container'); | ||
} | ||
return { controller: app || controller }; | ||
} | ||
@@ -41,0 +50,0 @@ }, { |
{ | ||
"name": "@cerebral/inferno", | ||
"version": "4.0.0-1526409797341", | ||
"version": "4.0.0-1527015081471", | ||
"description": "Inferno view for Cerebral", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"cerebral": "^5.0.0-1526409797341" | ||
"cerebral": "^5.0.0-1527015081471" | ||
}, | ||
@@ -20,0 +20,0 @@ "scripts": { |
@@ -13,17 +13,11 @@ # @cerebral/inferno | ||
import { render } from 'inferno' | ||
import { Controller } from 'cerebral' | ||
import App from 'cerebral' | ||
import { Container } from '@cerebral/inferno' | ||
import App from './App' | ||
import AppComponent from './components/App' | ||
import main from './main' | ||
const controller = Controller({ | ||
state: { | ||
foo: 'bar' | ||
}, | ||
signals: { | ||
clicked: [] | ||
} | ||
}) | ||
const controller = App(main) | ||
render( | ||
<Container controller={controller}> | ||
<Container app={app}> | ||
<App /> | ||
@@ -39,12 +33,13 @@ </Container>, | ||
import { Component } from 'inferno' | ||
import {connect} from '@cerebral/inferno' | ||
import {state, signal} from 'cerebral/tags' | ||
import { connect } from '@cerebral/inferno' | ||
import { state, sequences } from 'cerebral/proxy' | ||
// Stateless | ||
export default connect({ | ||
foo: state`foo`, | ||
click: signal`clicked` | ||
}, | ||
function MyComponent ({foo, click}) { | ||
return <div onClick={() => click()}>{foo}</div> | ||
export default connect( | ||
{ | ||
foo: state.foo, | ||
onClick: sequences.onClick | ||
}, | ||
function MyComponent ({foo, onClick}) { | ||
return <div onClick={() => onClick()}>{foo}</div> | ||
} | ||
@@ -54,9 +49,10 @@ ) | ||
// Stateful | ||
export default connect({ | ||
foo: state`foo`, | ||
click: signal`clicked` | ||
}, | ||
export default connect( | ||
{ | ||
foo: state.foo, | ||
onClick: sequences.onClick | ||
}, | ||
class MyComponent extends Component { | ||
render () { | ||
return <div onClick={() => this.props.click()}>{this.props.foo}</div> | ||
return <div onClick={() => this.props.onClick()}>{this.props.foo}</div> | ||
} | ||
@@ -63,0 +59,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21441
267
59