forked from public/foundryvtt-reve-de-dragon
Utilisation d'async/await dans les listeners
Sans async await dans les feuilles, la feuille n'est pas toujours mise à jour, laissant visible des informations obsoletes
This commit is contained in:
@ -2,13 +2,13 @@ import { Misc } from "./misc.js";
|
||||
|
||||
export class DialogConsommer extends Dialog {
|
||||
|
||||
static async create(actor, item, onActionItem = async () => { }) {
|
||||
static async create(actor, item) {
|
||||
const consommerData = DialogConsommer.prepareData(actor, item);
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-item-consommer.html', consommerData);
|
||||
return new DialogConsommer(actor, item, consommerData, html, onActionItem)
|
||||
return new DialogConsommer(actor, item, consommerData, html)
|
||||
}
|
||||
|
||||
constructor(actor, item, consommerData, html, onActionItem = async () => { }) {
|
||||
constructor(actor, item, consommerData, html) {
|
||||
const options = { classes: ["dialogconsommer"], width: 350, height: 'fit-content', 'z-index': 99999 };
|
||||
let conf = {
|
||||
title: consommerData.title,
|
||||
@ -16,10 +16,7 @@ export class DialogConsommer extends Dialog {
|
||||
default: consommerData.buttonName,
|
||||
buttons: {
|
||||
[consommerData.buttonName]: {
|
||||
label: consommerData.buttonName, callback: async it => {
|
||||
await this.onConsommer();
|
||||
await onActionItem();
|
||||
}
|
||||
label: consommerData.buttonName, callback: async it => await this.onConsommer()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user