darkness-dependent-vision/src/module/hooks/getTokenConfigHeaderButtons.js

25 lines
754 B
JavaScript
Raw Normal View History

2021-06-29 20:40:54 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
import { DarknessDependentVisionConfig } from '../darkness-dependent-vision-config';
export default function registerForGetTokenConfigHeaderButtonsHook() {
Hooks.on('getTokenConfigHeaderButtons', onGetTokenConfigHeaderButtons);
}
/**
* @param {TokenConfig} tokenConfig
* @param {ApplicationHeaderButton[]} buttons
*/
function onGetTokenConfigHeaderButtons(tokenConfig, buttons) {
buttons.unshift({
label: 'DarknessDependentVision.TokenConfigHeaderButtonLabel',
class: 'configure-darkness-dependent-vision',
icon: 'fas fa-eye',
onclick: async () => {
return new DarknessDependentVisionConfig(tokenConfig.object).render(true);
},
});
}