# Type alias SubAppDef

SubAppDef: SubAppOptions & {
_features?: Record<string, SubAppFeature>;
_frameworkFactory?: (() => unknown);
_getExport?: (<T>() => SubApp<T>);
_getModule: (() => Promise<any>);
_id: number;
_module: any;
_pipelineFactory?: ((params) => SubAppRenderPipeline);
_renderPipelines?: SubAppRenderPipeline[];
_ssr: boolean;
_mount?(info): void;
_reload?(subAppName, modName?): Promise<any>;
_start?(params, reload?): Promise<any>;
_unmount?(info): void;
}

definition of a subapp from `declareSubApp`

To see example of implement and declare a subapp, see a framework specific SubApp implementation type, such as `ReactSubApp`.

#### Type declaration

- ##### `Optional` _features?: Record<string, SubAppFeature>

  Features this subapp wants

- ##### `Optional` _frameworkFactory?: (() => unknown)

  factory to return a framework object for the running env. it's unknown because we don't know what the env or the framework could be.

  - - (): unknown

    - #### Returns unknown

- ##### `Optional` _getExport?: (<T>() => SubApp<T>)

  Get the export subapp object from the module

  - - <T>(): SubApp<T>

    - #### Type Parameters

      - T

      #### Returns SubApp<T>

- ##### _getModule: (() => Promise<any>)

  handle loading the subapp's module

  - - (): Promise<any>

    - #### Returns Promise<any>

- ##### _id: number

  Unique definition ID, if a subapp with same name is re-declared then it will have a diff _id

- ##### _module: any

  The module that implements the subapp

- ##### `Optional` _pipelineFactory?: ((params) => SubAppRenderPipeline)

  Create a render pipeline

  The respective env/framework specific implementation should set this accordingly

  - - (params): SubAppRenderPipeline

    - #### Parameters

      - params: PipelineFactoryParams

      #### Returns SubAppRenderPipeline

- ##### `Optional` _renderPipelines?: SubAppRenderPipeline[]

  Holds rendering pipeline instances for this subapp.

  This is only used on client side. On server side, there are multiple page rendering for multiple requests. We need to maintain and manage the pipelines for each request. So they are stored in their owning request object.

- ##### _ssr: boolean

  Indicate if this subapp involves being used in any server side rendering TODO: this is not the right place for this? Since different routes could be using the same subapp def but not for SSR.

- ##### _mount?:function

  - _mount(info): void

  - For UI component instance to let the subapp know it's mounting to the subapp

    #### Parameters

    - info: SubAppMountInfo

    #### Returns void

    - Defined in subapp/types.ts:248

- ##### _reload?:function

  - _reload(subAppName, modName?): Promise<any>

  - Handles HMR on client side

    #### Parameters

    - subAppName: string
    - `Optional` modName: string

    #### Returns Promise<any>

    - Defined in subapp/types.ts:227

- ##### _start?:function

  - _start(params, reload?): Promise<any>

  - SubApp's start method that declareSubApp will create, with versions for browser or node.js.

    - Browser: the browser subapp shell will call this from start.
    - Node.js: load-v2.ts in node dir will call this during SSR.

    #### Parameters

    - params: SubAppStartParams
    - `Optional` reload: boolean

    #### Returns Promise<any>

    - Defined in subapp/types.ts:219

- ##### _unmount?:function

  - _unmount(info): void

  - For UI component instance to let the subapp know it's unmounting from the subapp

    #### Parameters

    - info: SubAppMountInfo

    #### Returns void

    - Defined in subapp/types.ts:251

- Defined in subapp/types.ts:191