mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
fix: settings props not being correctly set
This commit is contained in:
@@ -1,18 +1,26 @@
|
||||
import type { Plugin } from '../../core/types';
|
||||
import { BasePlugin, BooleanSetting } from '../../core/settings';
|
||||
import type { Plugin } from '@/plugins/core/types';
|
||||
import { BasePlugin } from '@/plugins/core/settings';
|
||||
import { defineSettings, booleanSetting, Setting } from '@/plugins/core/settingsHelpers';
|
||||
|
||||
class TestPluginClass extends BasePlugin {
|
||||
@BooleanSetting({
|
||||
// Step 1: Define settings with proper typing
|
||||
const settings = defineSettings({
|
||||
someSetting: booleanSetting({
|
||||
default: true,
|
||||
title: "Test Plugin",
|
||||
description: "Some random setting",
|
||||
})
|
||||
});
|
||||
|
||||
// Step 2: Create the plugin class with @Setting decorators
|
||||
class TestPluginClass extends BasePlugin<typeof settings> {
|
||||
@Setting(settings.someSetting)
|
||||
someSetting!: boolean;
|
||||
}
|
||||
|
||||
// Step 3: Instantiate and plug it in
|
||||
const settingsInstance = new TestPluginClass();
|
||||
|
||||
const testPlugin: Plugin<typeof settingsInstance.settings> = {
|
||||
const testPlugin: Plugin<typeof settings> = {
|
||||
id: 'test',
|
||||
name: 'Test Plugin',
|
||||
description: 'A test plugin for BetterSEQTA+',
|
||||
@@ -24,6 +32,8 @@ const testPlugin: Plugin<typeof settingsInstance.settings> = {
|
||||
|
||||
const { unregister } = api.seqta.onPageChange((page) => {
|
||||
console.log('Page changed to', page);
|
||||
|
||||
console.log('Current setting value:', api.settings.someSetting);
|
||||
});
|
||||
|
||||
return () => {
|
||||
@@ -33,4 +43,4 @@ const testPlugin: Plugin<typeof settingsInstance.settings> = {
|
||||
}
|
||||
};
|
||||
|
||||
export default testPlugin;
|
||||
export default testPlugin;
|
||||
|
||||
Reference in New Issue
Block a user