constructor()

in codelab-initial-state/public/js/homepage.js [46:78]


  constructor(db, auth) {
    this.db = db;
    this.auth = auth;

    this.headerBar = new HeaderBar([
      new HeaderIcon("sign_in", "account_circle", "Sign In", () => {
        this.onSignInClicked();
      }),
      new HeaderIcon("cart", "shopping_cart", "N/A", () => {
        this.showCart();
      })
    ]);

    this.itemCardList = new ItemCardList(async (id, data) => {
      try {
        await this.addToCart(id, data);
      } catch (e) {
        console.warn(e);
        this.showError("Error adding item to cart");
      }
    });

    this.modalDialog = new ModalDialog("Cart", "Nothing here.");

    this.el = el("div.header-page", [
      this.headerBar,
      this.itemCardList,
      this.modalDialog
    ]);

    this.listenForAuth();
    this.listenForItems();
  }