Skip to content

Commit

Permalink
docs: update api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
notaphplover committed Dec 5, 2024
1 parent 12a125f commit daa13dc
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions wiki/container_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ An advanced feature that can be used for cross cutting concerns. See [middleware
## container.createChild(containerOptions?: interfaces.ContainerOptions): Container;

Create a [container hierarchy ](https://github.com/inversify/InversifyJS/blob/master/wiki/hierarchical_di.md). If you do not provide options the child receives the options of the parent.

## container.get\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>): T

Resolves a dependency by its runtime identifier. The runtime identifier must be associated with only one binding and the binding must be synchronously resolved, otherwise an error is thrown:
Expand Down Expand Up @@ -585,6 +586,55 @@ Restore container state to last snapshot.
## container.snapshot(): void

Save the state of the container to be later restored with the restore method.

## container.tryGet\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>): T | undefined

Same as `container.get`, but returns `undefined` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetAsync\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>): Promise<T | undefined>

Same as `container.getAsync`, but returns `Promise<undefined>` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetNamed\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, named: string | number | symbol): T | undefined

Same as `container.getNamed`, but returns `undefined` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetNamedAsync\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, named: string | number | symbol): Promise\<T | undefined>

Same as `container.getNamedAsync`, but returns `Promise<undefined>` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetTagged\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, key: string | number | symbol, value: unknown): T | undefined

Same as `container.getTagged`, but returns `undefined` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetTaggedAsync\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, key: string | number | symbol, value: unknown): Promise\<T | undefined>

Same as `container.getTaggedAsync`, but returns `Promise<undefined>` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetAll\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, options?: interfaces.GetAllOptions): T[]

Same as `container.getAll`, but returns `[]` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetAllAsync\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, options?: interfaces.GetAllOptions): Promise\<T[]>

Same as `container.getAllAsync`, but returns `Promise<[]>` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetAllNamed\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, named: string | number | symbol): T[]

Same as `container.getAllNamed`, but returns `[]` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetAllNamedAsync\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, named: string | number | symbol): Promise\<T[]>

Same as `container.getAllNamedAsync`, but returns `Promise<[]>` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetAllTagged\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, key: string | number | symbol, value: unknown): T[]

Same as `container.getAllTagged`, but returns `[]` in the event no bindings are bound to `serviceIdentifier`.

## container.tryGetAllTaggedAsync\<T>(serviceIdentifier: interfaces.ServiceIdentifier\<T>, key: string | number | symbol, value: unknown): Promise\<T[]>

Same as `container.getAllTaggedAsync`, but returns `Promise<[]>` in the event no bindings are bound to `serviceIdentifier`.

## container.unbind(serviceIdentifier: interfaces.ServiceIdentifier\<unknown>): void

Remove all bindings binded in this container to the service identifier. This will result in the [deactivation process](https://github.com/inversify/InversifyJS/blob/master/wiki/deactivation_handler.md).
Expand Down

0 comments on commit daa13dc

Please sign in to comment.