-
Notifications
You must be signed in to change notification settings - Fork 0
Hooks
MajorVictory edited this page Oct 7, 2020
·
3 revisions
Hooooooooks
This hook is used to signal that whetstone is fully loaded and ready for your to register themes. This hook is fired after Foundry's 'ready' hook.
Hooks.once("WhetstoneReady", () => {
// register themes
game.Whetstone.themes.register(...);
//register menus
game.Whetstone.settings.registerMenu(...);
}
This hook is called just before a theme is activated. You can return Boolean false to cancel.
/**
* @param {WhetstoneTheme} themeData The theme being activated
* @return {Boolean} Return false to prevent
*/
Hooks.on('onThemeActivate', (themeData) => {
return true;
});
This hook is called just after a theme is activated.
/**
* @param {WhetstoneTheme} themeData The theme being activated
*/
Hooks.on('onThemeActivated', (themeData) => {
//do stuff
});
This hook is called just before a theme is deactivated. You can return Boolean false to cancel.
NOTE: When a theme is activated, Whetstone first deactivates all themes for a fresh slate meaning this hook is called many times when themes change.
/**
* @param {WhetstoneTheme} themeData The theme being activated
* @return {Boolean} Return false to prevent
*/
Hooks.on('onThemeDeactivate', (themeData) => {
return true;
});
This hook is called just after a theme is deactivated.
/**
* @param {WhetstoneTheme} themeData The theme being deactivated
*/
Hooks.on('onThemeDeactivated', (themeData) => {
//do stuff
});
This hook is called just after a setting has been updated for the given theme.
/**
* @param {Object} settingData The settings object being updated
* @param {Object} newValue Newβ’! The value's new value
* @param {Object} currentValue The current stinky value
*/
Hooks.on('updateOceanBlues', (settingData, newValue, currentValue) => {
// do things
});
// casing must match theme's id ('MyTheme', 'CharliesChocolateFaCtOrY', etc..)
Hooks.on('updateCharliesChocolateFaCtOrY', (settingData, newValue, currentValue) => {
// do things
});