Skip to content

Class: TrayMenuService

Makaio Framework


Makaio Framework / services-core / TrayMenuService

Defined in: ../../../packages/services/core/src/tray-menu/tray-menu-service.ts:37

In-memory registry for package-contributed tray menu entries.

Registrations are idempotent and keyed by owning package. The service owns tray menu state for every host surface; renderers consume it through the host:tray.list RPC and observe mutations through host:tray.changed.

  • BaseService

new TrayMenuService(bus): TrayMenuService

Defined in: ../../../packages/services/core/src/tray-menu/tray-menu-service.ts:61

Create a tray menu service.

IMakaioBus

Bus instance used for tray menu subjects

TrayMenuService

BaseService.constructor

protected readonly bus: IMakaioBus

Defined in: ../../../packages/services/base/src/base-service.ts:39

Bus instance used for registering handlers

BaseService.bus


readonly static critical: true

Defined in: ../../../packages/services/core/src/tray-menu/tray-menu-service.ts:40


readonly static needs: readonly []

Defined in: ../../../packages/services/core/src/tray-menu/tray-menu-service.ts:39

Dependency tokens required before this service.

get initialized(): boolean

Defined in: ../../../packages/services/base/src/base-service.ts:47

Whether the service has been successfully initialized.

Returns true after init() completes and before destroy() is called.

boolean

true if initialized, false otherwise

BaseService.initialized

protected addCleanup(fn): void

Defined in: ../../../packages/services/base/src/base-service.ts:143

Enqueue an arbitrary cleanup function to be called on destroy().

Use for non-handler resources (timers, external subscriptions, etc.).

() => void | Promise<void>

Function to invoke during teardown

void

BaseService.addCleanup


destroy(): Promise<void>

Defined in: ../../../packages/services/base/src/base-service.ts:89

Destroy the service and unsubscribe all registered handlers.

Calls the optional onDestroy() hook before running cleanups, then resets the initialized flag. Safe to call multiple times (idempotent).

Promise<void>

Promise that resolves after teardown completes

BaseService.destroy


init(): Promise<void>

Defined in: ../../../packages/services/base/src/base-service.ts:57

Initialize the service.

Delegates to onInit() once; subsequent calls are no-ops (idempotent).

Promise<void>

Promise that resolves when initialization is complete

BaseService.init


protected onDestroy(): void

Defined in: ../../../packages/services/core/src/tray-menu/tray-menu-service.ts:107

Optional service teardown hook.

Called by destroy() before automatic handler unsubscription. Implement only when there are resources beyond bus handlers to clean up (e.g., stopping trackers, clearing maps, releasing external handles).

void

BaseService.onDestroy


protected onInit(): void

Defined in: ../../../packages/services/core/src/tray-menu/tray-menu-service.ts:65

Service initialization hook.

Called once by init(). Register bus handlers via registerHandler() and other cleanup resources via addCleanup() here.

void

Promise or void — async is allowed

BaseService.onInit


protected registerHandler<S>(subject, handler): void

Defined in: ../../../packages/services/base/src/base-service.ts:129

Register a bus handler and enqueue its unsubscribe function for teardown.

Equivalent to this._cleanups.push(this.bus.on(subject, handler)).

S extends SubjectDefinition

S

The subject definition to listen on

HandlerForSubjectDefinition<S>

Handler function for the subject

void

BaseService.registerHandler


static create(ctx): Promise<TrayMenuService>

Defined in: ../../../packages/services/core/src/tray-menu/tray-menu-service.ts:47

Factory for DI container startup.

Start context providing the bus

IMakaioBus

Promise<TrayMenuService>

Initialized TrayMenuService instance