@loopback/docs
Version:
Documentation for LoopBack 4
56 lines (42 loc) • 2.69 kB
Markdown
---
lang: en
title: 'API docs: boot.bootmixin'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.boot.bootmixin.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/boot](./boot.md) > [BootMixin](./boot.bootmixin.md)
## BootMixin() function
Mixin for @<!-- -->loopback/boot. This Mixin provides the following: - Implements the Bootable Interface as follows. - Add a `projectRoot` property to the Class - Adds an optional `bootOptions` property to the Class that can be used to store the Booter conventions. - Adds the `BootComponent` to the Class (which binds the Bootstrapper and default Booters) - Provides the `boot()` convenience method to call Bootstrapper.boot() - Provides the `booter()` convenience method to bind a Booter(s) to the Application - Override `component()` to call `mountComponentBooters` - Adds `mountComponentBooters` which binds Booters to the application from `component.booters[]`
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* NOTE \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Trying to constrain the type of this Mixin (or any Mixin) will cause errors. For example, constraining this Mixin to type Application require all types using by Application to be imported (including it's dependencies such as ResolutionSession). Another issue was that if a Mixin that is type constrained is used with another Mixin that is not, it will result in an error. Example (class MyApp extends BootMixin(RepositoryMixin(Application))) {<!-- -->}<!-- -->; \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* END OF NOTE \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
<b>Signature:</b>
```typescript
export declare function BootMixin<T extends Constructor<any>>(superClass: T): {
new (...args: any[]): {
[x: string]: any;
projectRoot: string;
bootOptions?: BootOptions | undefined;
boot(): Promise<void>;
booters(...booterCls: Constructor<Booter>[]): Binding<any>[];
component(component: Constructor<{}>): void;
mountComponentBooters(component: Constructor<{}>): void;
};
} & T;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| superClass | <code>T</code> | |
<b>Returns:</b>
`{
new (...args: any[]): {
[x: string]: any;
projectRoot: string;
bootOptions?: BootOptions | undefined;
boot(): Promise<void>;
booters(...booterCls: Constructor<Booter>[]): Binding<any>[];
component(component: Constructor<{}>): void;
mountComponentBooters(component: Constructor<{}>): void;
};
} & T`