Skip to content

Instantly share code, notes, and snippets.

@bhaibel
Created October 30, 2018 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhaibel/a758a489df2f48e18c4e310c30df4e89 to your computer and use it in GitHub Desktop.
Save bhaibel/a758a489df2f48e18c4e310c30df4e89 to your computer and use it in GitHub Desktop.
Metrics & Async/Await -- snippet 3
async function showPrice(item) {
const priceWithoutShipping = onSale ? salePrice(item) : item.price;
const shippingCost = await shippingRate(item);
const totalPrice = priceWithoutShipping + shippingCost;
showUserTotal(totalPrice);
return totalPrice;
await postMetrics('userCheckoutStep3', totalPrice);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment