# Class default

Abstract class for all components in the Trilium's frontend.

Contains also event implementation with following properties:

- event / command distribution is synchronous which among others mean that events are well-ordered - event which was sent out first will also be processed first by the component
- execution of the event / command is asynchronous - each component executes the event on its own without regard for other components.
- although the execution is async, we are collecting all the promises, and therefore it is possible to wait until the event / command is executed in all components - by simply awaiting the `triggerEvent()`.

#### Hierarchy (View Summary)

- TypedComponent < default >
  - default
    - NoteContext

- Defined in src/public/app/components/component.ts:129

##### Index

### Constructors

constructor

### Properties

_position
$widget
children
componentId
initialized
parent?

### Accessors

position
sanitizedClassName

### Methods

callMethod
child
handleEvent
handleEventInChildren
setParent
triggerCommand
triggerEvent

## Constructors

### constructor

- new default(): default

  #### Returns default

  Inherited from TypedComponent.constructor

  - Defined in src/public/app/components/component.ts:23

## Properties

### _position

_position: number

Inherited from TypedComponent._position

- Defined in src/public/app/components/component.ts:21

### $widget

$widget: JQuery<HTMLElement>

Inherited from TypedComponent.$widget

- Defined in src/public/app/components/component.ts:16

### children

children: default []

Inherited from TypedComponent.children

- Defined in src/public/app/components/component.ts:18

### componentId

componentId: string

Inherited from TypedComponent.componentId

- Defined in src/public/app/components/component.ts:17

### initialized

initialized: null | Promise<void>

Inherited from TypedComponent.initialized

- Defined in src/public/app/components/component.ts:19

### `Optional` parent

parent?: TypedComponent <any>

Inherited from TypedComponent.parent

- Defined in src/public/app/components/component.ts:20

## Accessors

### position

- get position(): number

  #### Returns number

  Inherited from TypedComponent.position

  - Defined in src/public/app/components/component.ts:34
- set position(newPosition: number): void

  #### Parameters

  - newPosition: number

  #### Returns void

  Inherited from TypedComponent.position

  - Defined in src/public/app/components/component.ts:38

### sanitizedClassName

- get sanitizedClassName(): string

  #### Returns string

  Inherited from TypedComponent.sanitizedClassName

  - Defined in src/public/app/components/component.ts:29

## Methods

### callMethod

- callMethod(
  fun: (arg: unknown) => Promise<unknown>,
  data: unknown,
  ): undefined | Promise<unknown>

  #### Parameters

  - fun: (arg: unknown) => Promise<unknown>
  - data: unknown

  #### Returns undefined | Promise<unknown>

  Inherited from TypedComponent.callMethod

  - Defined in src/public/app/components/component.ts:105

### child

- child(...components: default []): default

  #### Parameters

  - ...components: default []

  #### Returns default

  Inherited from TypedComponent.child

  - Defined in src/public/app/components/component.ts:47

### handleEvent

- handleEvent< T extends EventNames >(
  name: T ,
  data: EventData < T >,
  ): undefined | null | Promise<unknown>

  #### Type Parameters

  - T extends EventNames

  #### Parameters

  - name: T
  - data: EventData < T >

  #### Returns undefined | null | Promise<unknown>

  Inherited from TypedComponent.handleEvent

  - Defined in src/public/app/components/component.ts:57

### handleEventInChildren

- handleEventInChildren< T extends EventNames >(
  name: T ,
  data: EventData < T >,
  ): null | Promise<unknown>

  #### Type Parameters

  - T extends EventNames

  #### Parameters

  - name: T
  - data: EventData < T >

  #### Returns null | Promise<unknown>

  Inherited from TypedComponent.handleEventInChildren

  - Defined in src/public/app/components/component.ts:76

### setParent

- setParent(parent: TypedComponent <any>): default

  #### Parameters

  - parent: TypedComponent <any>

  #### Returns default

  Inherited from TypedComponent.setParent

  - Defined in src/public/app/components/component.ts:42

### triggerCommand

- triggerCommand< K extends keyof CommandMappings >(
  name: K ,
  data?: CommandMappings [ K ],
  ): undefined | null | Promise<unknown>

  #### Type Parameters

  - K extends keyof CommandMappings

  #### Parameters

  - name: K
  - `Optional` data: CommandMappings [ K ]

  #### Returns undefined | null | Promise<unknown>

  Inherited from TypedComponent.triggerCommand

  - Defined in src/public/app/components/component.ts:91

### triggerEvent

- triggerEvent< T extends EventNames >(
  name: T ,
  data: EventData < T >,
  ): undefined | null | Promise<unknown>

  #### Type Parameters

  - T extends EventNames

  #### Parameters

  - name: T
  - data: EventData < T >

  #### Returns undefined | null | Promise<unknown>

  Inherited from TypedComponent.triggerEvent

  - Defined in src/public/app/components/component.ts:72