# Events

> Listen for the cart being mounted or changed.

## Cart mounted

Listening to the cart mounted event can be made by listening to the `circuly-cart-mounted` event.

```js
const onMounted = (event) => {
    console.debug("Cart mounted!")
    // 
}

window.addEventListener("circuly-cart-mounted", onMounted);
```

## Cart changed

Listening to cart state changes can be made by listening to the `circuly-cart-changed` event.

```js
const onChanged = (event) => {
    console.debug("Cart changed!", event.detail)
    // 
}

window.addEventListener("circuly-cart-changed", onChanged);
```

---

## Cart interface structure

```ts
interface CartItem {
  id: number;
  sku: string;
  name: string;
  children: object[];
}
```

```ts
interface Cart {
  cart_id: string;
  items: CartItem[];
}
```
