Skip to content

Commit

Permalink
chore: update README (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
maou-shonen authored Oct 24, 2024
1 parent e684aec commit e55e50c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ const app = new Hono()
### Do not provide an initialization function

```ts
const userServiceDep = new Dependency<UserService | null>();

const userServiceDep = new Dependency<UserService | null>(() => null);
```

## API
Expand Down Expand Up @@ -168,6 +167,14 @@ interface Dependency<Service> {
*/
injection(service: Service): this

/**
* Clear injected service.
*/
clearInjected(): this {
this.service = undefined;
return this;
}

/**
* Creates a middleware that injects the service into the context.
* @param contextKey - Optionally override the key used to store the service in the context.
Expand Down

0 comments on commit e55e50c

Please sign in to comment.