RC-65 | Gear | Display Data

This commit is contained in:
Oliver-Akins 2025-01-25 23:49:51 -07:00
parent 9a3b82ef6a
commit 1e416ff9bf
10 changed files with 172 additions and 39 deletions

27
module/Apps/utils.mjs Normal file
View file

@ -0,0 +1,27 @@
/*
This file contains utilities used by Applications in order to be DRYer
*/
/**
* @param {HTMLElement} target The element that gets
*/
export async function editItemFromElement(target) {
const itemEl = target.closest(`[data-item-id]`);
if (!itemEl) { return };
const itemId = itemEl.dataset.itemId;
if (!itemId) { return };
const item = await fromUuid(itemId);
item.sheet.render({ force: true });
};
/**
* @param {HTMLElement} target The element that gets
*/
export async function deleteItemFromElement(target) {
const itemEl = target.closest(`[data-item-id]`);
if (!itemEl) { return };
const itemId = itemEl.dataset.itemId;
if (!itemId) { return };
const item = await fromUuid(itemId);
item.delete();
};