26 lines
815 B
JavaScript
26 lines
815 B
JavaScript
/**
|
|
* Remove the History tab hooks added by macro_enable-history-tab.js.
|
|
*/
|
|
|
|
const hooks = game.pf1?.historyTab?.renderHooks ?? (game.pf1?.historyTab?.renderHook ? [{ event: null, id: game.pf1.historyTab.renderHook }] : []);
|
|
if (!hooks.length) {
|
|
return ui.notifications.info("History tab hooks are not active.");
|
|
}
|
|
|
|
for (const hook of hooks) {
|
|
if (!hook) continue;
|
|
Hooks.off(hook.event ?? "renderActorSheet", hook.id ?? hook);
|
|
}
|
|
|
|
delete game.pf1.historyTab.renderHooks;
|
|
delete game.pf1.historyTab.renderHook;
|
|
|
|
if (game.pf1.historyTab.observers instanceof Map) {
|
|
for (const observer of game.pf1.historyTab.observers.values()) {
|
|
observer?.disconnect();
|
|
}
|
|
delete game.pf1.historyTab.observers;
|
|
}
|
|
|
|
ui.notifications.info("History tab hooks disabled. Close and reopen actor sheets to remove the tab.");
|