Skip to content

Commit

Permalink
Replace debouncedReload call with FVTT utility
Browse files Browse the repository at this point in the history
  • Loading branch information
Jagusti committed Aug 14, 2022
1 parent 8d679ca commit 7c20c11
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions modules/gm-toolkit-settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import { strip } from "./utility.mjs"

export class GMToolkitSettings {

static debouncedReload = foundry.utils.debounce(() => {
window.location.reload()
}, 100)

static register () {

// Menu for Advantage handling
Expand All @@ -32,7 +28,7 @@ export class GMToolkitSettings {
config: false,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "advantage"
})
// Automate advantage for outmanouvring and losing wounds from unopposed tests
Expand All @@ -43,7 +39,7 @@ export class GMToolkitSettings {
config: false,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "advantage"
})
// Clear advantage when suffering a condition
Expand All @@ -54,7 +50,7 @@ export class GMToolkitSettings {
config: false,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "advantage"
})
// Prompt to lose advantage when not gained in a round
Expand All @@ -65,7 +61,7 @@ export class GMToolkitSettings {
config: false,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "advantage"
})
// Clear Advantage when token is added to combat tracker
Expand All @@ -76,7 +72,7 @@ export class GMToolkitSettings {
config: false,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "advantage"
})
// Clear Advantage when token is removed from combat tracker
Expand All @@ -87,7 +83,7 @@ export class GMToolkitSettings {
config: false,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "advantage"
})
game.settings.register(GMToolkit.MODULE_ID, "persistAdvantageNotifications", {
Expand All @@ -97,7 +93,7 @@ export class GMToolkitSettings {
config: false,
default: false,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "advantage"
})

Expand Down Expand Up @@ -140,7 +136,7 @@ export class GMToolkitSettings {
config: false,
default: false,
type: Boolean,
onChange: this.debouncedReload,
onChange: debouncedReload,
feature: "session"
})
game.settings.register(GMToolkit.MODULE_ID, "addXPDefaultAmount", {
Expand All @@ -155,7 +151,7 @@ export class GMToolkitSettings {
max: 200,
step: 5
},
onChange: this.debouncedReload,
onChange: debouncedReload,
feature: "session"
})
game.settings.register(GMToolkit.MODULE_ID, "addXPDefaultReason", {
Expand All @@ -165,7 +161,7 @@ export class GMToolkitSettings {
config: false,
default: "Session %session% (%date%)",
type: String,
onChange: this.debouncedReload,
onChange: debouncedReload,
feature: "session"
})
game.settings.register(GMToolkit.MODULE_ID, "holdingScene", {
Expand Down Expand Up @@ -306,7 +302,7 @@ export class GMToolkitSettings {
config: true,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "tokenhud"
})

Expand All @@ -318,7 +314,7 @@ export class GMToolkitSettings {
config: true,
default: true,
type: Boolean,
onChange: GMToolkitSettings.debouncedReload,
onChange: debouncedReload,
feature: "grouptests"
})

Expand Down

0 comments on commit 7c20c11

Please sign in to comment.