Title

Global

Members

Array.<Object>

buttonsDOM

array of buttons objects represents buttons.btn-bag

  • note "those buttons created and populated into DOM using javascript"

View Source index.js, line 101

Array.<cartItem>

cart

array of cartItem objects represents products was added to cart

View Source index.js, line 94

Object

constant cartBtn

assigning div.cart-btn DOM to cartBtn object

View Source index.js, line 19

Object

constant cartContent

assigning div.cart-content html DOM element to cartContent object

View Source index.js, line 78

Object

constant cartDOM

assigning div.cart DOM to cartDOM object

View Source index.js, line 45

Array.<Object>

constant cartItems

assigning div.cart-items html DOM element to cartItems object

View Source index.js, line 61

Object

constant cartOverlay

assigning div.overlay DOM to cartOverlay object

View Source index.js, line 53

Object

constant cartTotal

assigning span.cart-total html DOM element to cartTotal object

View Source index.js, line 70

Object

constant clearBtn

assigning button.clear-cart DOM to clearBtn object

View Source index.js, line 36

constant client

external api provied demo data for testing or populating the UI

View Source index.js, line 1

Object

constant closeCartBtn

assigning div.close-cart DOM to closeCartBtn object

View Source index.js, line 27

contentful

asigning items to contentful object

View Source index.js, line 137

Array

products

assigning to an array

View Source index.js, line 151

Object

constant productsDOM

assigning div.products-center html DOM element to productsDOM object

View Source index.js, line 86

Methods

displayProducts(products)

takes an array of products and populate the DOM

UI

Parameters:
Name Type Description
products Array.<Objects>

to be displayed

See:

View Source index.js, line 189

inner getCart() → {Array.<Object>}

reading (fetching) cartItems array cart from the browser local storage

Storage

Parameters:
Type Description
Array.<Object>

View Source index.js, line 422

cart

Array.<Object>
Example
Storage.getCart()

async inner getProducts() → {Array.<Object>}

fetching and destructuring items(products) then assigning them to an array of product object

Products

View Source index.js, line 118

[] [array of product object]

Array.<Object>
Example
products.getProducts();

inner getProducts(id) → {Object}

reading products from the browser localt storage takes the id of product as a parameter and returns product matches that array

Storage

Parameters:
Name Type Description
id number

of item to be fetched

View Source index.js, line 393

Object
Example
Storage.getProducts(1);

map array higher order function(function) → {Array.<Object>}

destructuring items from the array then reassign as

Parameters:
Name Type Description
function

View Source index.js, line 158

Array.<Object>

inner saveCart(cart)

saving cartItems array in the browser local storage takes the cart items array as a parameter

Storage

Parameters:
Name Type Description
cart Array.<Object>

items cartItems to be saved

View Source index.js, line 409

Example
Storage.saveCart(cart)

inner saveProducts(pruducts)

saving products in the browser localt storage takes products array as a parameter products

Storage

Parameters:
Name Type Description
pruducts Array.<Object>

to be saved

View Source index.js, line 379

Example
Storage.saveProducts(products);