Create types for items.

This commit is contained in:
Oliver Rümpelein 2020-12-28 18:24:13 +01:00
parent a84df2d80b
commit 1ef66a2023
4 changed files with 50 additions and 14 deletions

View file

@ -54,16 +54,16 @@ export class DS4ItemSheet extends ItemSheet<DS4ItemDataType, DS4Item> {
if (!this.options.editable) return;
html.find(".effect-create").click(this._onEffectCreate.bind(this));
html.find(".effect-create").on("click", this._onEffectCreate.bind(this));
html.find(".effect-edit").click((ev) => {
html.find(".effect-edit").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".effect");
console.log(li.data("effectId"));
const effect = this.item["effects"].get(li.data("effectId")); // TODO: replace ["..."]
const effect = this.item["effects"].get(li.data("effectId")); //
effect.sheet.render(true);
});
html.find(".effect-delete").click(async (ev) => {
html.find(".effect-delete").on("click", async (ev) => {
const li = $(ev.currentTarget).parents(".effect");
await this.item.deleteEmbeddedEntity("ActiveEffect", li.data("effectId"));
});
@ -74,7 +74,7 @@ export class DS4ItemSheet extends ItemSheet<DS4ItemDataType, DS4Item> {
* @param {Event} event The originating click event
* @private
*/
async _onEffectCreate(event: JQuery.ClickEvent): Promise<unknown> {
private async _onEffectCreate(event: JQuery.ClickEvent): Promise<unknown> {
event.preventDefault();
const label = `New Effect`;