Pebble App Framework: Phone API
    Preparing search index...

    Function handleSettings

    • Answers the plugin app's settings page.

      A load gets every setting, secret ones included, so the page opens on what was saved, and a secret that cannot be read fails the load so the page cannot save over it. A save keeps the settings and then has the Pebble app read the sources the plugin names again, so a changed setting shows without waiting for the next refresh. Anything that fails is answered with the reason, which the page shows.

      The plugin runtime takes one config handler, so a plugin app that answers messages of its own, or acts on a save, does it through hooks rather than a handler of its own. With no hooks, a message that is neither the load nor the save is answered with an error.

      Saves are kept one at a time, in the order they came in, so a second save never reads the settings halfway through the first one's write.

      Parameters

      • options: SettingsOptions = {}

        The plugin app's secret keys, defaults, and sources to read again.

      • pebble: PluginPebble = ...

        The plugin runtime's Pebble, which a spec stands in for.

      • storage: SettingsStorage = localStorage

        Where the settings that are not secret are kept, normally localStorage.

      • hooks: SettingsHooks = {}

        The plugin app's answer to its own messages, and what it does once a save is kept.

      Returns void