1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Plugins: Add support for joplin.settings.values and deprecate joplin.settings.value

This commit is contained in:
Laurent Cozic 2024-09-29 17:44:08 +01:00
parent f165b3f870
commit 715abcce32

View File

@ -147,6 +147,20 @@ export default class JoplinSettings {
}
/**
* Gets setting values (only applies to setting you registered from your plugin)
*/
public async values(keys: string[] | string): Promise<Record<string, unknown>> {
if (typeof keys === 'string') keys = [keys];
const output: Record<string, unknown> = {};
for (const key of keys) {
output[key] = Setting.value(getPluginNamespacedSettingKey(this.plugin_.id, key));
}
return output;
}
/**
* @deprecated Use joplin.settings.values()
*
* Gets a setting value (only applies to setting you registered from your plugin)
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied