Allow extension developers to save non-bundled settings

philiplawrence

24-02-2019

One of the principles behind Launch is to bundle only what you need to keep the library light and fast for the end user. While developing extensions I've made sure to keep as few items loaded and kept the settings objects as small as possible. But there are also times where I want to save settings/preferences that should not be bundled in the Launch library.

The two main use cases I see here:

  • Partially disabling a feature within an extension where we want to keep the settings for when the user wants to re-enable the feature. For example, the Adobe Analytics plugin - if I disable the exit link tracking, I still want the list of internal domains to be saved, but I don't necessarily need it output on my site since we're not using it. Right now I have to choose between saving the settings and having unnecessary (albeit small) bloat in the bundled lib, or not saving the settings and when the user comes back to re-enable the feature they have to re-setup everything.
  • User interface preferences, like opting out of tracking, changing languages, etc. These right now can be saved to localStorage or a cookie, but that's only good for the one device. Plus, these are settings I absolutely don't need to have published, ever.

I'm not sure on the best solution to this, but I was thinking a specific property in the settings object that extensions returned would still save but not be bundled, e.g.:

{

  "name": "foobar",

  "someVal": "barfoo",

  "protected": {

    "myPrivateSetting": true

  }

}

Comment