OptionalonAnswers a message from the settings page that is neither the load nor the save, such as one asking
for something only the plugin can read. It calls respond once, before it returns or before its
promise settles. A message it does not reply to in that time gets the error handleSettings gives
a message it does not know, so the page is never left waiting, and a respond after that is only
logged. Only the first reply goes to the page. A hook that throws before replying is answered with
the error, and one that throws after is logged.
OptionalonHears a save once it is kept, with the settings before and after it. Each has the defaults under what was saved and leaves out every secret key, so a key that was saved in plain storage before the plugin made it secret is left out too.
The hook runs, and its promise settles, before the page hears the save as kept, since the Pebble app ends the plugin's run as soon as the page is answered and a hook still running then may never finish. The Pebble app is asked to read the sources again after the hook, so a run it starts sees what the hook did. The plugin runtime has no timers, so nothing cuts a slow hook short. The page gives up on a save after about five seconds and shows it as not answered, though the settings are already kept, so keep the hook's work well inside that. The hooks run one at a time in the order the saves came in, and each hears the settings as its own save left them. A hook that never settles holds every later save in the run the same way, kept but never answered, its hook never run and the sources never read again. A hook that throws or rejects is logged, and the page still hears the save as kept.
What a plugin app's own code hears from
handleSettings, beside the load and the save it answers.