fix(dialogs): refresh gestion herbes/potions/ingredients après édition fiche
Souscrit aux hooks updateItem/createItem/deleteItem pour re-render le dialog quand un item de l'acteur change. Nettoyage des hooks via _onClose().
This commit is contained in:
@@ -36,6 +36,18 @@ export class DialogGererHerbes extends HandlebarsApplicationMixin(ApplicationV2)
|
||||
constructor(options) {
|
||||
super(options)
|
||||
this.actor = options.actor
|
||||
this._onItemChange = (item) => {
|
||||
if (item.parent === this.actor) this.render(true)
|
||||
}
|
||||
Hooks.on("updateItem", this._onItemChange)
|
||||
Hooks.on("createItem", this._onItemChange)
|
||||
Hooks.on("deleteItem", this._onItemChange)
|
||||
}
|
||||
|
||||
_onClose() {
|
||||
Hooks.off("updateItem", this._onItemChange)
|
||||
Hooks.off("createItem", this._onItemChange)
|
||||
Hooks.off("deleteItem", this._onItemChange)
|
||||
}
|
||||
|
||||
async _prepareContext() {
|
||||
|
||||
@@ -34,6 +34,18 @@ export class DialogGererIngredients extends HandlebarsApplicationMixin(Applicati
|
||||
constructor(options) {
|
||||
super(options)
|
||||
this.actor = options.actor
|
||||
this._onItemChange = (item) => {
|
||||
if (item.parent === this.actor) this.render(true)
|
||||
}
|
||||
Hooks.on("updateItem", this._onItemChange)
|
||||
Hooks.on("createItem", this._onItemChange)
|
||||
Hooks.on("deleteItem", this._onItemChange)
|
||||
}
|
||||
|
||||
_onClose() {
|
||||
Hooks.off("updateItem", this._onItemChange)
|
||||
Hooks.off("createItem", this._onItemChange)
|
||||
Hooks.off("deleteItem", this._onItemChange)
|
||||
}
|
||||
|
||||
async _prepareContext() {
|
||||
|
||||
@@ -34,6 +34,18 @@ export class DialogGererPotions extends HandlebarsApplicationMixin(ApplicationV2
|
||||
constructor(options) {
|
||||
super(options)
|
||||
this.actor = options.actor
|
||||
this._onItemChange = (item) => {
|
||||
if (item.parent === this.actor) this.render(true)
|
||||
}
|
||||
Hooks.on("updateItem", this._onItemChange)
|
||||
Hooks.on("createItem", this._onItemChange)
|
||||
Hooks.on("deleteItem", this._onItemChange)
|
||||
}
|
||||
|
||||
_onClose() {
|
||||
Hooks.off("updateItem", this._onItemChange)
|
||||
Hooks.off("createItem", this._onItemChange)
|
||||
Hooks.off("deleteItem", this._onItemChange)
|
||||
}
|
||||
|
||||
async _prepareContext() {
|
||||
|
||||
Reference in New Issue
Block a user