Standard storefront events and actions
To react to a buyer adding an item to the cart, your app used to read the storefront's DOM or intercept window.fetch, which meant a separate integration for every storefront. Standard storefront events and actions give every storefront the same names and payloads, so one integration works on all of them.
Storefronts dispatch an event when a buyer does something, such as viewing a product or updating the cart. You listen for those with addEventListener. Every standard event is named with a shopify: prefix and bubbles to document, so one listener there catches all of them. You only get an event if that storefront dispatches it, though cart changes made through updateCart are emitted by the action itself.
You call an action when you need the storefront to change something, such as adding to cart or opening the cart. Actions are available on every Liquid storefront, and the storefront decides how each one happens, so your code works the same whether its cart is a drawer or a page.