Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanlee committed Oct 19, 2017
1 parent 0b9663e commit 7fbfbca
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,44 +103,44 @@ define a custom element and connect it to React component.

observe an dom attribute change

```js
import {observed} from 'xeact';
```js
import {observed} from 'xeact';

static propTypes = {
@observed
header: PropTypes.string,
};
```
static propTypes = {
@observed
header: PropTypes.string,
};
```

```xml
<x-box>...</x-box>
<script>
document.querySelector('x-box').setAttribute('header', 'new header');
</script>
```
```xml
<x-box>...</x-box>
<script>
document.querySelector('x-box').setAttribute('header', 'new header');
</script>
```

the box component will receive prop header: 'new header'

the box component will receive prop header: 'new header'

### exposed

expose react method to dom api.

```js
import {exposed} from 'xeact';
```js
import {exposed} from 'xeact';

@exposed
method(...args) {
...
}
```

```xml
<x-box>...</x-box>
<script>
document.querySelector('x-box').method(arg);
</script>
```
@exposed
method(...args) {
...
}
```

```xml
<x-box>...</x-box>
<script>
document.querySelector('x-box').method(arg);
</script>
```

### dispatchEvent(context, name, eventData)

Expand Down

0 comments on commit 7fbfbca

Please sign in to comment.