Skip to content

Commit

Permalink
chore: readme up
Browse files Browse the repository at this point in the history
  • Loading branch information
betula committed Dec 1, 2023
1 parent e89fc8c commit 3d784a6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,33 @@ browser or native usage
import { provide } from "provi/client"

// Define dependencies using "provide" function
export class Auth {
user = provide(User)
class Auth {
// user = sharedUser()
// ...
logout() {
if (this.user.isAnonymous) return
if (sharedUser().isAnonymous) return
// ...
}
}

export const sharedAuth = () => provide(Auth)
```

in both ways you can use plain javascript functions as dependency constructor

```javascript
import { provide } from "provi/client"

export const User => {
const User = () => {
// ...
return {
get isAnonymous() {
return true;
}
}
}

export const sharedUser = () => provide(User)
```

**Isolation of async scopes** (only in node environment)
Expand Down

0 comments on commit 3d784a6

Please sign in to comment.