-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9522963
commit 0bae455
Showing
3 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,53 @@ | ||
# Service Providers | ||
|
||
|
||
- [Introduction](#introduction) | ||
- [Creating Service Providers](#creating-service-providers) | ||
- [The Register method](#the-register-method) | ||
- [The Boot method](#the-boot-method) | ||
- [Registering Providers](#registering-providers) | ||
|
||
|
||
|
||
## Introduction | ||
tba. | ||
|
||
|
||
## Creating Service Providers | ||
All service providers should extends the `ServiceProvider` class provided by `@supercharge/support`. The main methods you can implement in your service provider are `register` and `boot`: | ||
|
||
```ts | ||
import { ServiceProvider } from '@supercharge/support' | ||
import { MarkdownRenderer } from './markdown-renderer' | ||
|
||
export class MarkdownServiceProvider extends ServiceProvider { | ||
/** | ||
* Register application services to the container. | ||
*/ | ||
override register (): void { | ||
this.app().singleton(MarkdownRenderer, () => { | ||
return new MarkdownRenderer(this.app()) | ||
}) | ||
} | ||
|
||
/** | ||
* Boot application services. | ||
*/ | ||
override async boot (): Promise<void> { | ||
await this.app().make(MarkdownRenderer).boot() | ||
} | ||
} | ||
``` | ||
|
||
|
||
|
||
### The Register Method | ||
tba. | ||
|
||
|
||
### The Boot Method | ||
tba. | ||
|
||
|
||
## Registering Providers | ||
tba. |