Handlers
Join the Closed Beta
The Beacon SDK is currently in closed Beta. Please complete the form to sign up for the closed beta.
Join to get access to the Beacon SDK, the community sheet repo for Beacon sheet, the community sheet developers in discord, and the new sheet developer Roll20 permissions.
Handler methods allow the sheet to respond to data passed from the Roll20 Tabletop or Roll20 Characters (both refered to as host throughout this page) to the sheet. It is the main agrument that must be passed into initRelay
or the sheet will never fully load.
onInit
The onInit
method receives the initial data from the host.
This will be the first time we have access to character data, sheet settings, as well as compendium data if this character is made as a result of a compendium drag and drop on the host.
This function may be called multiple times during development in the sheet sandbox as part of hot reloads.
onChange
onChange
is called whenever a character’s data is changed on the host’s end. The event object contains a partial character with only the character’s ID and the changed data. This could be the character’s bio, GM notes, or attributes (only the changed attributes).
onSettingsChange
onSettingsChange
is called when either the host’s color theme is changed, or when the current player’s ownership of the primary character changes.
onSharedSettingsChange
onSharedSettingsChange
is called when someone changes a shared setting in the host.
onTranslationsRequest
onTranslationsRequest
is called before the relay is fully initialized and returns the translation JSON data corresponding to the two-letter language argument.
onDragOver (optional)
onDragOver
is called when a compendium item from the compendium tab is dragged over the iframe window containing the character sheet.
Coordinates of the drag are provided via top and left values, and basic compendium data is passed so that a subsequent compendium request can be made via the provided dispatch. If the item is moved outside of the iframe, dragData
and coordinates
are null.
onDropOver (optional)
onDropOver
is called when a compendium item from the compendium tab is dropped over the iframe window containing the character sheet.
Coordinates of the drop are provided via top and left values, and basic compendium data is passed so that a subsequent compendium request can be made via the provided dispatch.