+1 vote
1.8k views
in Module Development by (584 points) 16 28 37 1 1

I am trying to register a setting for my module and I need Foundry to reload when the value is changed. How can I do that?

1 Answer

0 votes
by (584 points) 16 28 37
selected by
 
Best answer
0

From the documentation, you can add a onChange property to the settings option when registering:

game.settings.register("myModule", "myClientSetting", {
  choices: {
    "a": "Option A",
    "b": "Option B"
  },
  default: "a",
  onChange: value => {
    debounceReload()
  }
});

Make sure to use debouceReload() to avoid issues (like some settings not being saved correctly)

...