Re-factor Communications with the Companion App.

Re-factor and improve the code that connects the Blocks Editor to the
Companion App. In particular remove the 2 second timer that was used
to "poll" if there were changes in the blocks. Instead modified blocks
are sent to the phone when they are modified, subject to some
throttling code that prevents too many updates when changes are
occuring rapidly (say when a person is typing the text for a text
block, each chacater typed is technically a block change).

Handle network errors when communicating with the companion. In
particular provide an appropriate dialog to the user and reset the
state of the connection, advising the user to restart the Companion
and reconnect.  Arrange to the "Connect To" pull-down to recognize
when the Blocks editor is no longer connected to the Companion.

The code in replmgr.js has been processed by "jshint" (jslint for
Emacs) and recommended changes implemented.

Change-Id: Ibdea91b9ee6f68593122354d2c335df25cb83567