A module which provides documentation for the various hook events which are dispatched throughout the Foundry Virtual Tabletop client-side software. Packages can respond to these events by using the Hooks.on method.

Systems and modules can add their own hooks by using Hooks.call or Hooks.callAll; This page is only a listing of the hooks called by core. See package pages for information about the hooks they provide.

Hooks - The class responsible for managing hook events

Every time a client connects to the server, either from logging in or refreshing the page, it always goes through the following hooks in order and never calls them again. Other hooks may fire during this time, such as canvas drawing hooks, but those other hooks will also fire when relevant changes happen in world (such as switching scenes).

  1. init
  2. i18nInit
  3. setup
  4. initializeDynamicTokenRingConfig
  5. initializeCombatConfiguration
  6. canvasConfig (if the Canvas is enabled)
  7. ready

Many of the commonly used hooks in Foundry are "generic", which is to say the actual name of the hook is dynamic based on the class that is calling the hook. While looking for the appropriate hook to use for your code, keep these in mind as possible candidates.

Some hooks, such as preCreateDocument, can be cancelled by returning an explicit false. These hooks mention this capability and note that they return boolean | void. Hooks are never awaited, which means that an async function will always return a Promise, which is not a boolean. This is an important limitation to keep in mind while working with these kinds of hooks.

Interfaces

RenderChatInputContext

Events - AVSettings

rtcSettingsChanged

Events - ActiveEffect

applyActiveEffect

Events - Actor

modifyTokenAttribute

Events - ActorSheet

dropActorSheetData

Events - AdventureImporter

importAdventure
preImportAdventure

Events - ApplicationV1

closeApplicationV1
getApplicationV1HeaderButtons
renderApplicationV1

Events - ApplicationV2

closeApplicationV2
getDocumentContextOptions
getHeaderControlsApplicationV2
renderApplicationV2

Events - AudioHelper

globalVolumeChanged

Events - Canvas

canvasConfig
canvasDraw
canvasInit
canvasPan
canvasReady
canvasTearDown
dropCanvasData
highlightObjects
initializeEdges

Events - CanvasGroup

drawGroup
tearDownGroup

Events - CanvasLayer

drawLayer
pastePlaceableObject
tearDownLayer

Events - CanvasVisibility

initializeVisionMode
initializeVisionSources
sightRefresh
visibilityRefresh

Events - Cards

dealCards
passCards
returnCards

Events - ChatBubbles

chatBubbleHTML

Events - ChatLog

chatInput
chatMessage
renderChatInput

Events - ChatMessage

renderChatMessageHTML

Events - ClientSettings

clientSettingChanged

Events - Combat

combatRound
combatStart
combatTurn
combatTurnChange
initializeCombatConfiguration

Events - CompendiumCollection

updateCompendium

Events - Document

applyCompendiumArt
createDocument
deleteDocument
preCreateDocument
preDeleteDocument
preUpdateDocument
updateDocument

Events - EffectsCanvasGroup

initializeLightSources
initializePriorityLightSources
lightingRefresh

Events - EnvironmentCanvasGroup

configureCanvasEnvironment
initializeCanvasEnvironment

Events - Game

error
hotReload
i18nInit
init
pauseGame
ready
setup
streamReady
updateWorldTime

Events - Hotbar

hotbarDrop

Events - InteractionLayer

activateCanvasLayer
activateLayer
deactivateLayer

Events - Note

activateNote

Events - PlaceableObject

controlObject
destroyObject
drawObject
hoverObject
refreshObject

Events - ProseMirrorEditor

createProseMirrorEditor

Events - ProseMirrorMenu

getProseMirrorMenuDropDowns
getProseMirrorMenuItems

Events - RenderedEffectSource

initializeRenderedEffectSourceShaders

Events - RollTableSheet

dropRollTableSheetData

Events - SceneControls

getSceneControlButtons

Events - SceneNavigation

collapseSceneNavigation

Events - Sidebar

changeSidebarTab
collapseSidebar

Events - Token

applyTokenStatusEffect
targetToken

Events - TokenDocument

moveToken
pauseToken
preMoveToken
recordToken
stopToken

Events - TokenRingConfig

initializeDynamicTokenRingConfig

Events - Users

userConnected

Events - WeatherEffects

initializeWeatherEffects