new update

This commit is contained in:
2026-06-29 15:27:35 +03:30
parent 2e159dde20
commit be17631109
33 changed files with 3713 additions and 351 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { Product } from '@/models/products'
type ProductListHandler = (products: Product[]) => void
const handlers = new Set<ProductListHandler>()
export function subscribeProductListStream(handler: ProductListHandler) {
handlers.add(handler)
return () => {
handlers.delete(handler)
}
}
export function applyProductsListFromStream(products: Product[]) {
if (!Array.isArray(products) || !products.length) {
return
}
handlers.forEach((handler) => handler(products))
}