LP#1718301 Offline db connections via promise user/berick/lp1718301-lovefield-offline-connection-refactor
authorBill Erickson <berickxx@gmail.com>
Tue, 19 Sep 2017 21:58:55 +0000 (17:58 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 19 Sep 2017 21:58:57 +0000 (17:58 -0400)
commita86b93a66603018d2539ee78071ca83e4b12dcec
treee6e6fa61bcf5127b630618d08f6f293b338d0dd5
parentad11d47214f7c565140de6aae4893ddc3d1925c6
LP#1718301 Offline db connections via promise

Refactors offline DB connection call to return a promise, resolved upon
successful connection, instead of polling for a successful connection
within the connect call.

Multiple calls to the main egLoveField connect function will result in
resolvers being linked to the same in-progress promise.

Check for connection errors via the database.connect() reject handler.

Avoid attempts to connect to the offline DB until egLoveField.connectOrGo()
is called the first time.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/services/lovefield.js