Skip to content

Commit

Permalink
docs: Updated documentations
Browse files Browse the repository at this point in the history
  • Loading branch information
mnasyrov committed May 29, 2024
1 parent 2a957e6 commit 4b7e951
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions packages/ditox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class UserService {
}

// Define tokens for injections.
const STORAGE_TOKEN = token<UserService>('Token description for debugging');
const STORAGE_TOKEN = token < UserService > 'Token description for debugging';
const LOGGER_TOKEN = token();
const USER_SERVICE_TOKEN = token();

Expand Down Expand Up @@ -164,15 +164,15 @@ Ditox.js supports managing the lifetime of values which are produced by
factories. There are the following types:

- `singleton` - **This is the default**. The value is created and cached by the
container which registered the factory.
- `scoped` - The value is created and cached by the container which starts
resolving.
most distant parent container which owns the factory function.
- `scoped` - The value is created and cached by the nearest container which owns
the factory function.
- `transient` - The value is created every time it is resolved.

### `singleton`

**This is the default scope**. "Singleton" allows to cache a produced value by a
parent container which registered the factory:
most distant parent container which registered the factory function:

```js
import {creatContainer, token} from 'ditox';
Expand Down
4 changes: 2 additions & 2 deletions packages/ditox/src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export type FactoryScope = 'scoped' | 'singleton' | 'transient';
* Options for factory binding.
*
* `scope` types:
* - `singleton` - **This is the default**. The value is created and cached by the container which registered the factory.
* - `scoped` - The value is created and cached by the container which starts resolving.
* - `singleton` - **This is the default**. The value is created and cached by the most distant parent container which owns the factory function.
* - `scoped` - The value is created and cached by the nearest container which owns the factory function.
* - `transient` - The value is created every time it is resolved.
*
* `scoped` and `singleton` scopes can have `onRemoved` callback. It is called when a token is removed from the container.
Expand Down
4 changes: 2 additions & 2 deletions packages/ditox/src/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export type AnyModuleDeclaration = ModuleDeclaration<Module<AnyObject>>;
* Options for module binding.
*
* `scope` types:
* - `singleton` - **This is the default**. The module is created and cached by the container which registered the factory.
* - `scoped` - The module is created and cached by the container which starts resolving.
* - `singleton` - **This is the default**. The value is created and cached by the most distant parent container which owns the factory function.
* - `scoped` - The value is created and cached by the nearest container which owns the factory function.
*/
export type BindModuleOptions = {
scope?: 'scoped' | 'singleton';
Expand Down

0 comments on commit 4b7e951

Please sign in to comment.