Skip to content

Commit

Permalink
add docs for observable values
Browse files Browse the repository at this point in the history
  • Loading branch information
kof committed Sep 17, 2017
1 parent 6547a44 commit c905331
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/json-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Compiles to:

## Function values

If you want dynamic behavior for your Style Sheet, you can use functions as a value which return the actual value. Use [sheet.update(data)](./js-api.md#update-function-values) in order to pass the data object.
If you want dynamic behavior for your Style Sheet, you can use functions as a value which return the actual value. Use [sheet.update(data)](./js-api.md#update-function-values) in order to pass the data object. Sheet option `link: true` is required for this to function.

```javascript
const styles = {
Expand All @@ -34,6 +34,20 @@ const styles = {
}
```

## Observable values

In order to create highly dynamic animations you may want to use streams. Take a look at the [tc39 observable proposal](https://github.com/tc39/proposal-observable). Sheet option `link: true` is required for this to function.

```javascript
const styles = {
button: {
color: new Observable((observer) => {
observer.next('red')
})
}
}
```

## Media Queries

```javascript
Expand Down

0 comments on commit c905331

Please sign in to comment.