0 votes
979 views
in Module Development by (584 points) 16 28 37 0 0

I want to reset a hidden setting when a button in the module settings is clicked.

I first tried to do a FormApplication that does not have a template. While it does allow me to do what I want, it also shows an error in the console, so it's not great.

Here's what I got:

this.gameRef.settings.registerMenu(this.getModuleName(), 'reset position', {
  name: '',
  label: 'Reset window position',
  type: Reset,
  restricted: true
});

and here's the class that's being used

class Reset extends FormApplication {
  protected _updateObject(event: Event, formData?: object): Promise<unknown> {
    throw new Error('Method not implemented.');
  }

  static get defaultOptions() {
    const options = super.defaultOptions;
    options.template = '';
    return options;
  }

  constructor() {
    super({});
    global[moduleJson.class].resetPosition();
  }
}

Your answer

Preview

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...