Skip to main content
cngx-src documentation

connectPaginateEmit

Functioncommon/data/paginatev0.1.0

projects/common/data/paginate/paginate-emit.ts

Description#

Wires the CngxPaginate brain's page / page-size changes onto a host's two-way outputs with exactly-once emit semantics. Two paths feed each handler, sharing a last-emitted guard:

  • a subscription forwards the brain's nav-only pageChange / pageSizeChange
    • the only signal that captures a controlled-mode setPage, because the brain's pageIndex() stays pinned to the input until the consumer feeds it back;
  • an effect() reads the effective pageIndex() / pageSize() and covers a total-shrink clamp the nav-only output misses.

The shared guard makes a value one path already emitted a no-op on the other, so each change emits exactly once. Seeded with the current effective values, so wiring emits no initial change.

Shared verbatim by the CngxPaginator shell and the CngxIncrementalList organism, so the two-way emit behaviour is byte-identical. Call inside an injection context (constructor or field initialiser) - it reads DestroyRef and creates effects.

Signature#

connectPaginateEmit(paginate: CngxPaginate, handlers: CngxPaginateEmitHandlers)

Parameters#

@parampaginateCngxPaginate

Returns#

void