Plugins API - Saving settings


I was playing around the Plugins API and I was wondering if the interface provides any native means for storing persistent data like authentication tokens.

As far as I understood, the settings object only provides an interface to the settings menu.

If this storage function is not implemented, what would be the recommended way of storing persistent data by the plugins? Could I use something simple like the HTML5 storage API or it would be better to save in a flat file?


For now you can either:

  • Create a new private setting (set public to false) and save the data to it, maybe by serializing to JSON first.
  • Or use the fs package (you can also use fs-extra) and save/load the settings to a file yourself.

There's a key/value store in Joplin which I'm planning to expose in the plugin API, as that would make it easier to quickly save/load cache and other settings.

We should require a pliugin namespace or add it automatically for new settings from plugins. Otherwise this could be a mess when 2 plugins try to use the same setting name.

It's all there :slight_smile:


Thank you! Private setting means it will not be visible in the settings page?

Yes that's right.