Events

Events are the core communication mechanism in SBCanvas. Subscribe with on(), once(), or after().

Activity Events

Fired when a viewer action occurs. Format: activity:{type}
EventPayload
activity:followActivity<'follow'>
activity:subscribeActivity<'subscribe'>
activity:gift_subActivity<'gift_sub'>
activity:rantActivity<'rant'>
activity:tipActivity<'tip'>
activity:raidActivity<'raid'>
activity:hostActivity<'host'>
SBCanvas.on('activity:subscribe', (activity) => {
  console.log(activity.username, activity.tier, activity.message);
});

System Events

EventPayloadWhen
readynoneRuntime fully initialized
session:readysession objectBackend connected, session populated
session:updatesession objectSession data changed
goal:updategoals arrayGoal progress changed
chat:messagemessage objectNew chat message received
layout:changelayout configDashboard updated widget layout
emotes:loademote setNew emote set loaded

Alert Events

EventPayloadWhen
alert:triggeralert dataNew alert to display (legacy)
alert:queue_changequeue stateQueue length or pause state changed

Widget Events

EventPayloadWhen
widget:field_change{ key, value, fieldData, widgetId }setField() was called
widget:*anyCustom events via SBCanvas.emit()

Store Events

EventPayloadWhen
store:update{ key, value }A store key was written

Channel Events

EventPayloadWhen
channel:{name}anyA named channel received a publish

Activity Payload

Every activity shares this shape:
interface Activity {
  id: string;
  type: 'follow' | 'subscribe' | 'gift_sub' | 'rant' | 'tip' | 'raid' | 'host';
  provider: 'kick' | 'rumble' | 'blaze';
  username: string;
  amount?: number;
  currency?: string;
  message?: string;
  tier?: string;
  gifted?: boolean;
  recipient?: string;
  viewers?: number;
  timestamp: number;
  raw: Record<string, any>;
}