FacetHandler
seco.facetedSearch
Service for mediating the communication between facets.
When created, the FacetHandler object broadcasts a sf-initial-constraints
event
on the given scope, with the following structure:
{Array}
- The constraints as generated by all the facets,
plus any initial constraints defined in the init configuration.{Object}
- A collection of facet states where the key is the
facetId
of the facet, and value is the state as emitted by that facet.{Object}
- The configuration given when instantiating
the FacetHandler.The FacetHandler object listens for two events:
sf-request-constraints
- In response will broadcast a
sf-initial-constraints
event
with the same object as above as the argument.sf-facets-changed
- In response will broadcast a
sf-facet-constraints
event on the scope with the same object as
above, except omitting config
.The event names are injectable as constants:
sf-initial-constraints
: EVENT_INITIAL_CONSTRAINTS
sf-facet-constraints
: EVENT_FACET_CONSTRAINTS
sf-request-constraints
: EVENT_REQUEST_CONSTRAINTS
sf-facet-changed
: EVENT_FACET_CHANGED
new FacetHandler(config);
Param | Type | Details |
---|---|---|
config | Object | Configuration object broadcast to all facets at init. The object has the following properties:
The object is sent to facets as is, and so any extra fields will be included, although the above fields are the only ones used by FacetHandler and the built-in facets. |