RC-65 | Gear | Display Data
This commit is contained in:
parent
9a3b82ef6a
commit
1e416ff9bf
10 changed files with 172 additions and 39 deletions
27
module/Apps/utils.mjs
Normal file
27
module/Apps/utils.mjs
Normal 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();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue