Add event handling for the custom input elements

This commit is contained in:
Oliver-Akins 2024-04-30 21:31:11 -06:00
parent 7b3ea59185
commit d1cb412e5a

View file

@ -43,6 +43,15 @@ export class GenericItemSheet extends ItemSheet {
if (!this.isEditable) return; if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`); console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`);
/*
Custom element event listeners because Foundry doesn't listen to them by
default.
*/
html.find(
CONFIG.CACHE.componentListeners.map(n => `${n}[name]`).join(`,`)
).on(`change`, () => this._onChangeInput.bind(this));
html.find(`button[data-increment]`) html.find(`button[data-increment]`)
.on(`click`, this._incrementValue.bind(this)); .on(`click`, this._incrementValue.bind(this));
html.find(`button[data-decrement]`) html.find(`button[data-decrement]`)