static setCartContents(newContents) { // If we're here, we had a valid username and password. // Store the username in our session storage. SyncStorage.set('cart-contents', JSON.stringify(newContents)); // Notify our listeners ShoppingCart.LISTENERS.forEach((curListener) => { curListener.forceUpdate(); }); }
static registerCartListener(handler) { ShoppingCart.LISTENERS.push(handler); }
static resetCart() { SyncStorage.set('cart-contents', JSON.stringify([])); // Notify our listeners ShoppingCart.LISTENERS.forEach((curListener) => { curListener.forceUpdate(); }); }