SBCanvas API
TheSBCanvas object is available globally inside every widget. Here’s the complete API.
Event System
| Method | Description |
|---|---|
ready(fn) | Run when runtime is initialized |
on(event, fn) | Subscribe to an event |
once(event, fn) | Subscribe once, auto-removes |
off(event, fn) | Unsubscribe a handler |
after(event, count, fn) | Fire after N occurrences |
emit(eventName, data) | Emit custom widget:{eventName} event |
State
Fields
Timers
Effects
Queue Control
Networking
Channels
Sanitization
Status
Namespaced APIs
| Namespace | Description | Page |
|---|---|---|
activities | Typed activity stream (follow, sub, tip, etc.) | |
platform | Connected platform info and feature detection | |
preview | Preview mode and test event injection | |
bind | Reactive DOM data binding | |
media | Media preloading and playback sequences | |
service | Background service lifecycle | |
panel | Dashboard control panel | |
queue | Alert queue inspection and control | |
chat | Send messages to chat | |
emotes | Emote resolution and sets | |
vars | In-memory runtime variables | |
store | Persistent async key-value storage |
Event Naming Convention
Activities can be listened to two ways:Activity object. Use activities.on() for readability. Use SBCanvas.on() when you need non-activity events like session:ready, chat:message, or store:update.