Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyWebb committed Oct 25, 2017
1 parent 03b4fc3 commit eda7447
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Expand Up @@ -23,9 +23,9 @@ $ yarn add ko-component-router

### Usage
_app.js_
```javascript
import $ from 'jquery'
import ko from 'knockout'
```typescript
import * as $ from 'jquery'
import * as ko from 'knockout'
import { Router } from 'ko-component-router'

const loading = ko.observable(true)
Expand Down Expand Up @@ -88,6 +88,13 @@ function loadingMiddleware(ctx) {
// loading(false)
// }

// TypeScript? Good for you! Just add ~water~ these lines
// declare module 'ko-component-router' {
// interface IContext {
// users: MyUserTypeDef[]
// }
// }

function loadUsers(ctx) {
// return promise for async middleware
return $.get('/api/users/').then((us) => ctx.users = us)
Expand Down

0 comments on commit eda7447

Please sign in to comment.