Merge remote-tracking branch 'origin/rewrite' into rewrite
This commit is contained in:
commit
72b011867d
6 changed files with 52 additions and 49 deletions
|
|
@ -83,7 +83,7 @@ The state of a component can be accessed three ways: as a blueprint at initializ
|
|||
|
||||
Any property attached to the component object is deep-cloned for every instance of the component. This allows simple state initialization.
|
||||
|
||||
In the example below, `data` is a property of the `Input` component's state object.
|
||||
In the example below, `data` is a property of the `ComponentWithInitialState` component's state object.
|
||||
|
||||
```javascript
|
||||
var ComponentWithInitialState = {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ Argument | Type | Required | Description
|
|||
|
||||
Creates a computed stream that reactively updates if any of its upstreams are updated. See [combining streams](#combining-streams)
|
||||
|
||||
`stream = prop.combine(combiner, streams)`
|
||||
`stream = m.prop.combine(combiner, streams)`
|
||||
|
||||
Argument | Type | Required | Description
|
||||
----------- | --------------------------- | -------- | ---
|
||||
|
|
@ -555,7 +555,7 @@ var errored2 = m.prop.combine(function(stream) {
|
|||
if (typeof stream() !== "string") {
|
||||
throw new Error("Not a string")
|
||||
}
|
||||
return value
|
||||
return stream()
|
||||
}, [stream])
|
||||
// errored2 is in an errored state
|
||||
```
|
||||
|
|
|
|||
|
|
@ -134,15 +134,15 @@ m.mount(document.body, {
|
|||
|
||||
m.mount(document.body, {
|
||||
oninit : function(vnode) {
|
||||
var ctrl = this; // this is bound to vnode.state by default
|
||||
var state = this; // this is bound to vnode.state by default
|
||||
|
||||
ctrl.fooga = 1;
|
||||
state.fooga = 1;
|
||||
},
|
||||
|
||||
view : function(vnode) {
|
||||
var ctrl = this; // this is bound to vnode.state by default
|
||||
var state = this; // this is bound to vnode.state by default
|
||||
|
||||
return m("p", ctrl.fooga);
|
||||
return m("p", state.fooga);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue