-
Notifications
You must be signed in to change notification settings - Fork 4
Debug mode
Debug mode is a highly specific setting within the additional configurations of UNITADE. It is relatively new and, for most of its timeline, was hidden, accessible only through runtime code ("console developer") or a specified config file for the plugin before the third generation ("v3*"). Now, it is part of the public settings.
Note
Debug mode can be useful only for users familiar with the basics of JavaScript and the Developer Console. If you are unfamiliar with these, this setting will not affect your experience as a user.
Debug mode was created for specific, understandable reasons: to debug particular modules of code. An example is provided below (code may differ in source):
const editorTheme = new Setting(containerEl)
.setName(this.locale.getLocaleItem('CODE_EDITOR_EDIT_THEME')[0]!)
.setDesc(this.locale.getLocaleItem('CODE_EDITOR_EDIT_THEME')[1]!)
.addDropdown(dropdown => {
dropdown
.addOptions(CONSTANTS.themes)
.setValue(this.plugin.settings.code_editor_settings.theme)
.onChange(async (value) => {
const next = {
...this.plugin.settings,
code_editor_settings: {
...this.plugin.settings.code_editor_settings,
theme: value,
},
};
if (this.plugin.settings.debug_mode)
console.debug('CAUGHT THEME FOR THE EDITOR:' + `${value};`);
await this.plugin.uptSettings(next);
this.__updateErrors();
});
return dropdown;
});
In this example, debug mode allows you to read the actual "code" of the theme that the code editor will apply (not the name shown in the dropdown in the UI), enabling you to programmatically verify what occurs.
Important
While debug mode can be helpful, it only exists in specific blocks of code.
Example of console output (may differ in source):
[592266.8000001907]: CAUSED UNLOADING FUNCTION! plugin:unitade:159279
[594106.4000000954]: CAUSED LOADING FUNCTION! plugin:unitade:159287