class {
    onMount() {
        this.purchaseEvents = [];
    }

    handleItemPurchase(item) {
        this.purchaseEvents.push(item);
    }
}

<div>
    <for(item in input.items)>
        <item item=item on-purchase('handleItemPurchase')/>
    </for>
</div>