Rewrite 'Preferences' to make it async

/cc @brendandahl Please look at this, and see if I'm on the right track with the rewrite.

This PR makes a number of changes to `Preferences`:
* Remove the class-like implementation, so that it's instead invoked once when the viewer loads.<br>
This change is necessary if we want to support preferences for the viewer itself, and not just when opening documents. (The second commit makes use of this to add a pref that enables the hand tool by default.)
* Changes all functions to be asynchronous.
* Adds docs. Some of it might be unnecessary or too verbose, so feedback is welcome on this.

Fixes #4459.