Skip to content

experimental new settings API#663

Draft
mProjectsCode wants to merge 1 commit into
masterfrom
new-settings-api
Draft

experimental new settings API#663
mProjectsCode wants to merge 1 commit into
masterfrom
new-settings-api

Conversation

@mProjectsCode
Copy link
Copy Markdown
Owner

No description provided.

if (value < MIN_SYNC_INTERVAL || value > MAX_SYNC_INTERVAL) {
return `Sync interval must be between ${MIN_SYNC_INTERVAL} and ${MAX_SYNC_INTERVAL}.`;
}
return undefined;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the function signature has | void, you can omit this final return (I know it feels weird)

import type { MetaBindSettingKey } from 'meta-bind-obsidian/src/settings/SettingsTypes';
import type { App, Setting, SettingDefinitionItem, SettingGroupItem } from 'obsidian';

export class ExcludedFolderSettings {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need a class for this. I'd recommend inlining this into the getSettingDefinitions. If you want some separation, just put it in a function on the setting tab instead of using a class. I think the class abstraction is awkward since you don't actually want to instantiate anything.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see, you have a bunch of pages. I that case, maybe just make these top-level functions instead of classes. I'm just worried that you're going to be capturing stale state in the class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants