Interface: ObsUtilsApi
@faeyumbrea/obs-utils-api-types
@faeyumbrea/obs-utils-api-types / ObsUtilsApi
Defined in: api.d.ts:88
Public compile-time contract for modules integrating with OBS Utils.
Properties
Section titled “Properties”directorTabs
Section titled “directorTabs”directorTabs:
Map<string,DirectorTabRegistration|DirectorTabSvelte5Registration>
Defined in: api.d.ts:95
obsRemoteEventTypes
Section titled “obsRemoteEventTypes”obsRemoteEventTypes:
Map<string,OBSRemoteEventTypeRegistration>
Defined in: api.d.ts:93
overlayTriggers
Section titled “overlayTriggers”overlayTriggers:
Map<string,OverlayTriggerRegistration>
Defined in: api.d.ts:94
overlayTypeNames
Section titled “overlayTypeNames”overlayTypeNames:
Map<string,string>
Defined in: api.d.ts:90
overlayTypes
Section titled “overlayTypes”overlayTypes:
Map<string,OverlayType>
Defined in: api.d.ts:89
singleInstanceOverlays
Section titled “singleInstanceOverlays”singleInstanceOverlays:
Set<Component>
Defined in: api.d.ts:91
singleInstanceOverlaysSvelte5
Section titled “singleInstanceOverlaysSvelte5”singleInstanceOverlaysSvelte5:
Set<(target) => () =>void>
Defined in: api.d.ts:92
Methods
Section titled “Methods”buildLegacyRollOverlayCanvas()
Section titled “buildLegacyRollOverlayCanvas()”buildLegacyRollOverlayCanvas(
config):OverlayData
Defined in: api.d.ts:157
Build a wysiwyg (canvas) overlay that emulates the 4.x roll overlay.
Shared by the v4 migration (5.0 type: 'roll' entries) and the docs
snippet that pulls the user’s legacy flat settings out of the world.
The returned overlay is a 250×250 layer with tileBy: 'players', a
core.onPlayerRoll transition out of the idle track, and the pre /
roll / post phases chained through transition-on-end.
Push the result into streamOverlays (or import it through the
composer) — this helper is data-only and does not touch settings.
Parameters
Section titled “Parameters”config
Section titled “config”Returns
Section titled “Returns”fireOverlayTrigger()
Section titled “fireOverlayTrigger()”fireOverlayTrigger(
key,payload):void
Defined in: api.d.ts:123
Public — modules call this when their in-system event fires (e.g. a chat message is created, a roll is made). Dispatches via Foundry’s Hooks bus so any number of overlay renderers can react without tight coupling.
Parameters
Section titled “Parameters”string
payload
Section titled “payload”Record<string, any>
Returns
Section titled “Returns”void
getDirectorState()
Section titled “getDirectorState()”getDirectorState():
DirectorState
Defined in: api.d.ts:115
Public — snapshot of Director state (tracking modes, combat, focused user).
Subscribe to obs-utils.director.stateChanged to react to changes; the
hook payload is (next: DirectorState, prev: DirectorState | undefined).
Returns
Section titled “Returns”getOBSWebsocketClient()
Section titled “getOBSWebsocketClient()”getOBSWebsocketClient():
Promise<any> |undefined
Defined in: api.d.ts:182
Returns
Section titled “Returns”Promise<any> | undefined
getSelectedActors()
Section titled “getSelectedActors()”getSelectedActors():
string[] |undefined
Defined in: api.d.ts:165
Returns
Section titled “Returns”string[] | undefined
isOBS()
Section titled “isOBS()”isOBS():
boolean
Defined in: api.d.ts:183
Returns
Section titled “Returns”boolean
playPreset()
Section titled “playPreset()”playPreset(
preset):void
Defined in: api.d.ts:193
Public — play a camera preset on the OBS client. The DM that calls this claims active-GM control, swaps the current tracking mode to cloneDM, pauses their outgoing viewport stream, and broadcasts the preset so it runs locally on every OBS client. The DM’s own view does not move.
For previewing a preset in the editor (no broadcast, no state changes),
call playSequence directly from cameraSequencePlayer.
Parameters
Section titled “Parameters”preset
Section titled “preset”Returns
Section titled “Returns”void
previewPreset()
Section titled “previewPreset()”previewPreset(
preset):SequenceController
Defined in: api.d.ts:198
Local-only preview play. Use this from the preset editor when scrubbing or auditioning — doesn’t touch tracking state and doesn’t broadcast.
Parameters
Section titled “Parameters”preset
Section titled “preset”Returns
Section titled “Returns”registerDirectorTab()
Section titled “registerDirectorTab()”registerDirectorTab(
reg):void
Defined in: api.d.ts:107
Public — register a tab in the Director window.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Deprecated
Section titled “Deprecated”A Svelte 5 component from another module fails to mount here (effect_orphan). Use
registerDirectorTabSvelte5, which lets your module mount its own UI. Still fine for
OBS Utils’ own (same-bundle) tabs.
registerDirectorTabSvelte5()
Section titled “registerDirectorTabSvelte5()”registerDirectorTabSvelte5(
reg):void
Defined in: api.d.ts:109
Public — register a Director tab whose UI your module mounts itself (cross-bundle-safe).
Parameters
Section titled “Parameters”DirectorTabSvelte5Registration
Returns
Section titled “Returns”void
registerOBSRemoteEventType()
Section titled “registerOBSRemoteEventType()”registerOBSRemoteEventType(
reg):void
Defined in: api.d.ts:98
Public — modules call this in their init hook to expose a new event type.
Parameters
Section titled “Parameters”OBSRemoteEventTypeRegistration
Returns
Section titled “Returns”void
registerOverlayTrigger()
Section titled “registerOverlayTrigger()”registerOverlayTrigger(
reg):void
Defined in: api.d.ts:100
Public — modules call this to expose a new overlay trigger type.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
registerOverlayType()
Section titled “registerOverlayType()”registerOverlayType(
key,readableName,type):void
Defined in: api.d.ts:144
Register a new overlay type. Surfaces in the Stream Composer’s “+ new” menu and elsewhere the type list is consumed.
Parameters
Section titled “Parameters”string
Stable key written into OverlayData.type (e.g. ‘wysiwyg’).
readableName
Section titled “readableName”string
i18n key for the display label. Resolved via
game.i18n.localize() at render time. Pass a literal string only if
you intentionally ship a single-locale module.
The OverlayType instance with the renderer and editor wired up.
Returns
Section titled “Returns”void
registerStarterOverlays()
Section titled “registerStarterOverlays()”registerStarterOverlays(
overlays):void
Defined in: api.d.ts:181
Public — system modules call this in their init hook to register their own starter overlay set. The burger menu in the overlay editor imports whichever set is registered (or the generic default if none). Last writer wins.
Parameters
Section titled “Parameters”overlays
Section titled “overlays”Returns
Section titled “Returns”void
registerUniqueOverlay()
Section titled “registerUniqueOverlay()”registerUniqueOverlay(
overlay):void
Defined in: api.d.ts:158
Parameters
Section titled “Parameters”overlay
Section titled “overlay”Component
Returns
Section titled “Returns”void
registerUniqueOverlaySvelte5()
Section titled “registerUniqueOverlaySvelte5()”registerUniqueOverlaySvelte5(
mount):void
Defined in: api.d.ts:164
Register a unique overlay rendered once on the stream, for Svelte 5 modules. Pass a mount callback
that mounts your overlay into the given element with your own module’s Svelte mount() and returns a
cleanup function — OBS Utils can’t mount a Svelte 5 component from another bundle itself (effect_orphan).
Parameters
Section titled “Parameters”(target) => () => void
Returns
Section titled “Returns”void
setAVData()
Section titled “setAVData()”setAVData(
actorValueArray):void
Defined in: api.d.ts:167
Parameters
Section titled “Parameters”actorValueArray
Section titled “actorValueArray”Returns
Section titled “Returns”void
setAVDataGrouped()
Section titled “setAVDataGrouped()”setAVDataGrouped(
groups):void
Defined in: api.d.ts:174
Public — system modules call this with a hierarchical layout. The picker
UI renders groups in the dropdown. Group labels are i18n keys, localized
at flatten time. Calling this replaces any previously-set AV data
(grouped or flat) — last writer wins, same as setAVData.
Parameters
Section titled “Parameters”groups
Section titled “groups”Returns
Section titled “Returns”void
setSelectedActors()
Section titled “setSelectedActors()”setSelectedActors(
actorArray):Promise<void>
Defined in: api.d.ts:166
Parameters
Section titled “Parameters”actorArray
Section titled “actorArray”string[]
Returns
Section titled “Returns”Promise<void>
setTrackingMode()
Section titled “setTrackingMode()”setTrackingMode(
slot,mode):Promise<void>
Defined in: api.d.ts:117
Public — set one of the tracking-mode slots. Mirrors the Controls tab UI.
Parameters
Section titled “Parameters”"inCombat" | "outOfCombat"
string
Returns
Section titled “Returns”Promise<void>
triggerOBSRemoteEvent()
Section titled “triggerOBSRemoteEvent()”triggerOBSRemoteEvent(
key,context?):Promise<void>
Defined in: api.d.ts:133
Public — modules call this when their in-system condition fires
(e.g. on updateActor with system.attributes.hp.value changed).
Looks up every configured instance for the type, runs the matcher,
and executes the configured OBS actions for instances that pass.
Safe to call from any client; the actual OBS action execution is already gated to the OBS-mode client by triggerOBSAction.
Parameters
Section titled “Parameters”string
context?
Section titled “context?”Record<string, any>
Returns
Section titled “Returns”Promise<void>