diff --git a/module/hooks/hotReload.mjs b/module/hooks/hotReload.mjs index 832686f..3150fb8 100644 --- a/module/hooks/hotReload.mjs +++ b/module/hooks/hotReload.mjs @@ -1,3 +1,4 @@ +import { reloadWindows } from "../utils.mjs"; import * as hbs from "../handlebars.mjs"; Hooks.on(`hotReload`, async (data) => { @@ -24,9 +25,7 @@ Hooks.on(`hotReload`, async (data) => { _templateCache[templateName] = template; // Re-render open windows - for (const window of ui.windows) { - window.render(true); - }; + reloadWindows(); return false; }); \ No newline at end of file diff --git a/module/utils.mjs b/module/utils.mjs new file mode 100644 index 0000000..8ad7c32 --- /dev/null +++ b/module/utils.mjs @@ -0,0 +1,13 @@ +export function reloadWindows(type = null) { + if (!type) { + for (const window of ui.windows) { + window.render(true); + }; + return; + }; + for (const window of ui.windows) { + if (window instanceof type) { + window.render(true); + }; + }; +}; \ No newline at end of file