Event API

TouchEventBus

Broadcasts app-wide lifecycle events to plugins so they can react without polling.

Event Enum

EventTrigger
APP_READYApp boot complete
APP_STARTAll modules started
ALL_MODULES_LOADEDExtension set finished loading
WINDOW_ALL_CLOSEDEvery window closed
PLUGIN_STORAGE_UPDATEDPlugin storage mutated

Subscribe

const dispose = ctx.events.on('APP_READY', () => {
  ctx.logger.info('App ready')
})

ctx.events.emit('PLUGIN_STORAGE_UPDATED', { pluginId: ctx.meta.id })

Custom Namespaces

  • ctx.events.createNamespace('todo') keeps plugin events isolated.
  • Always release handlers in onDestroy.

Debugging

  • Log payloads with ctx.logger.debug.
  • Turn on DevTools Performance to visualize the event timeline.