Add a hook into the image app that broadcasts when an image is uploaded/updated

This commit is contained in:
Oliver 2026-01-23 21:17:13 -07:00
parent 2d46160053
commit 2a1f8fd97d

View file

@ -114,6 +114,8 @@ export class ImageApp extends
path: this.#file ? path : ``,
};
await uploadJson(`db`, `images.json`, images);
Hooks.callAll(`${__ID__}.imageUploaded`, hash, images[hash]);
}
else {
const images = await getFile(this.constructor.dbPath);
@ -123,6 +125,8 @@ export class ImageApp extends
artists: data.artists,
});
await uploadJson(`db`, `images.json`, images);
Hooks.callAll(`${__ID__}.imageUpdated`, this._docID, images[this._docID]);
};
};
// #endregion Lifecycle