code: def _wait_for_js(self):
      
      # Wait for the Module Manager to load
      mod_mgr_script = ur"return window.hasOwnProperty('KindleModuleManager');"
      mod_mgr_loaded = lambda br: br.execute_script(mod_mgr_script)
      self._wait(5).until(mod_mgr_loaded)
  
      # Wait for the DB Client to load
      db_client_script = dedent(ur"""
          var done = arguments[0];
          if (!window.hasOwnProperty('KindleModuleManager') ||
              !KindleModuleManager
                  .isModuleInitialized(Kindle.MODULE.DB_CLIENT)) {
             done(false);
          } else {
              KindleModuleManager
                  .getModuleSync(Kindle.MODULE.DB_CLIENT)
                  .getAppDb()
                  .getAllBooks()
                  .done(function(books) { done(!!books.length); });
          }
          """)
      db_client_loaded = lambda br: br.execute_async_script(db_client_script)
      self._wait(5).until(db_client_loaded)
docs: Wait for the Kindle Cloud Reader JS modules to initialize.
  
      These modules provide the interface used to execute API queries.