EventAggregator
Send FactFinder requests through the event pipeline.
factfinder.communication.EventAggregator sends event-driven requests to FactFinder.
Send an event
Call addFFEvent() with an event type and its request parameters. Primitive properties become HTTP parameters. Functions and objects do not.
factfinder.communication.EventAggregator.addFFEvent({
type: "search",
query: "trousers"
});Common event types include search, suggest, filter, sort, paging, ppp, navigation, recommendation, similarProducts, advisor, and tagCloud.
type, url, fail, always, success, cancel, and searchImmediate are reserved. Use success, fail, and always for request callbacks.
Change requests before dispatch
Use addBeforeDispatchingCallback() to inspect or enrich every outgoing event. It returns a key for later removal.
window.addEventListener("ffReady", ({ eventAggregator }) => {
const key = eventAggregator.addBeforeDispatchingCallback((event) => {
if (event.type === "search") {
event.newConditionalHttpParam = "someValue";
}
});
// eventAggregator.removeBeforeDispatchingCallback(key);
});Target custom topics
Set topics to route an event response to selected ResultDispatcher topics.
Subscribe to customSearch with the ResultDispatcher to consume the response.
Last updated
Was this helpful?