Closed Blondwolf closed 7 months ago
Not sure about this personally. I dont find much documentation about Obsidian plugins dev.
It feels like this.settings.isDebug
for example can be accessible directly from the Plugin class. So the Plugin already has this settings. You could just send those setting in a class which is already created src/Model/Settings.js
.
If you want to simplify the parameters, you can just pass this.settings
from the main to other classes you need for treatment.
Then instead of
this.taskFinder = new TaskFinder(this.app.vault, this.settings.howToParseInternalLinks, this.settings.ignoreCompletedTasks, this.settings.ignoreOldTasks, this.settings.oldTaskInDays, this.settings.isIncludeTodos);
You can do
this.taskFinder = new TaskFinder(this.app.vault, this.settings);
And then process to get them back in the class the same way you would do with a singleton
this.howToParseInternalLinks = settings.howToParseInternalLinks;
this.ignoreCompletedTasks = settings.ignoreCompletedTasks;
Resolved in https://github.com/andrewbrereton/obsidian-to-ical-plugin/pull/51 and released in 1.15.0.
This ticket is to discuss about wether or not it would be a good idea to create a singleton to store global settings as mentioned here