(setting: Setting, options: ToggleSettingOptions)
| 162 | * Helper for configuring a toggle setting (works with SettingGroup.addSetting) |
| 163 | */ |
| 164 | export function configureToggleSetting(setting: Setting, options: ToggleSettingOptions): Setting { |
| 165 | return setting |
| 166 | .setName(options.name) |
| 167 | .setDesc(options.desc) |
| 168 | .addToggle((toggle) => { |
| 169 | toggle.setValue(options.getValue()).onChange((value) => { |
| 170 | runAsyncSettingCallback(() => options.setValue(value)); |
| 171 | }); |
| 172 | }); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Helper for creating standard toggle settings |
no test coverage detected