Skip to content

Commit

Permalink
docs(readme): add info about @@attached action type
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed Sep 3, 2016
1 parent 60dc2b0 commit ec2d201
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Expand Up @@ -177,12 +177,24 @@ update (state, {type, params}) {
switch (type) {
case '@@attr/some-custom-attribute':
return {count: state.count + parseInt(params)}
case default: return state
default: return state
}
}
```

## Listening to the attached event
A special action `@@attached` is fired when the component is attached into the DOM.
The `param` for this action is the instance of the web component.

```js
update (state, {type, params}) {
switch (type) {
case '@@attached':
return {width: params.getBoundingClientRect().width}
default: return state
}
}
```


<a name="module_raf"></a>
Expand Down
14 changes: 13 additions & 1 deletion docs/README.template.md
Expand Up @@ -177,12 +177,24 @@ update (state, {type, params}) {
switch (type) {
case '@@attr/some-custom-attribute':
return {count: state.count + parseInt(params)}
case default: return state
default: return state
}
}
```

## Listening to the attached event
A special action `@@attached` is fired when the component is attached into the DOM.
The `param` for this action is the instance of the web component.

```js
update (state, {type, params}) {
switch (type) {
case '@@attached':
return {width: params.getBoundingClientRect().width}
default: return state
}
}
```


{{>main}}

0 comments on commit ec2d201

Please sign in to comment.