Skip to content

Commit

Permalink
Added setting AppSate example related to canjs/canjs/3208
Browse files Browse the repository at this point in the history
  • Loading branch information
imaustink committed May 12, 2017
1 parent 00b4018 commit 0a526aa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions can-route.md
Expand Up @@ -73,6 +73,20 @@ Understanding how maps work is essential to understanding can-route.

You can listen to changes in a map with `on(eventName, handler(ev, args...))` and change can-route's properties by modifying `route.data`.

Create an `AppState` and attach it to a stache template like:

```js
const AppState = DefineMap.extend({
page: "string"
});

let appState = new AppState();
route.data = appState;

let renderer = stache("....")(appState);
route.ready();
```

### Listening to changes in can-route

Listen to changes in history by [can-event.addEventListener listening] to
Expand Down

0 comments on commit 0a526aa

Please sign in to comment.