From da05e46df2edfb9228018389ce9d080e9b27095a Mon Sep 17 00:00:00 2001 From: Robert McIntosh Date: Sun, 25 Sep 2022 22:06:21 -0400 Subject: [PATCH] Remove onchange patch (#33) * onchange patch Removed attaching an onchange event to core setting. Instead places it in `then` promise. * Update CHANGELOG.md * Update module.json * v1.4.5 switched to await. Fixed function logic. Added Comment to end of Line in hopes to make it easy to find to remove. * Update CHANGELOG.md --- CHANGELOG.md | 3 +++ js/find-the-culprit.js | 14 ++++---------- module.json | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de123e7..57989ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# v1.4.5 +- Moved window reload logic to `await` instead of core settings `onchange` event. Fixes incompatibility between MM+ and Ftc + # v1.4.4 - Now compatible with FVTT v10, thanks to @arcanist diff --git a/js/find-the-culprit.js b/js/find-the-culprit.js index ce69116..561e42b 100644 --- a/js/find-the-culprit.js +++ b/js/find-the-culprit.js @@ -15,14 +15,6 @@ function registerSetting() { }); } -// Temporarily required by foundryvtt/foundryvtt#7740 -Hooks.on("setup", () => { - if (game.release?.generation >= 10) { - game.settings.settings.get(`core.${ModuleManagement.CONFIG_SETTING}`).onChange = - foundry.utils.debouncedReload ?? window.location.reload; - } -}); - Hooks.on("renderModuleManagement", onRenderModuleManagement); function onRenderModuleManagement(app, html, options) { @@ -354,7 +346,8 @@ async function deactivationStep(chosenModules = []) { await game.settings.set(moduleName, "modules", currSettings); } - game.settings.set("core", ModuleManagement.CONFIG_SETTING, original); + await game.settings.set("core", ModuleManagement.CONFIG_SETTING, original) + (foundry.utils.debouncedReload ?? window.location.reload)(); // Temporarily required by foundryvtt/foundryvtt#7740 } async function reactivateModules() { @@ -364,7 +357,8 @@ async function reactivateModules() { ); for (let mod in curr.original) original[mod] = curr.original[mod]; - game.settings.set("core", ModuleManagement.CONFIG_SETTING, original); + await game.settings.set("core", ModuleManagement.CONFIG_SETTING, original) + (foundry.utils.debouncedReload ?? window.location.reload)(); // Temporarily required by foundryvtt/foundryvtt#7740 } async function resetSettings() { diff --git a/module.json b/module.json index b103b38..ee9045f 100644 --- a/module.json +++ b/module.json @@ -15,7 +15,7 @@ "bugs": "https://github.com/Moerill/fvtt-find-the-culprit/issues", "changelog": "https://github.com/Moerill/fvtt-find-the-culprit/blob/master/CHANGELOG.md", "flags": {}, - "version": "1.4.4", + "version": "1.4.5", "compatibility": { "minimum": "9", "verified": "10" @@ -32,6 +32,6 @@ "dependencies": [], "socket": false, "manifest": "https://raw.githubusercontent.com/Moerill/fvtt-find-the-culprit/master/module.json", - "download": "https://github.com/Moerill/fvtt-find-the-culprit/releases/download/v1.4.4/v1.4.4.zip", + "download": "https://github.com/Moerill/fvtt-find-the-culprit/releases/download/v1.4.5/v1.4.5.zip", "protected": false }