Gravatar for pblrok@gmail.com

Question by pblrok, Nov 27, 2017 9:15 AM

Coveo for sitecore 4.1 a custom lazy component

How can I register a custom lazy component that is located in a specific path to js file?

Something like this maybe Coveo.LazyInitialization.registerLazyComponent('LoadMoreButton',"/content/load-more-button.js") ? Can someone discribe me how it works?

Where component name and component file path is registrated?

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Nov 27, 2017 1:28 PM

While I appreciate your concern for Lazy Loading, you need to know that it comes at a certain cost: It introduces some overhead.

Lazy Loading helps in one specific scenario: When you *don't know if your component will be used in the page* and that component is *code-heavy*. It is a good fit if you want to code reusable custom components part of a larger custom library.

Custom components are a good idea, but you _will_ use your custom component on your own page. :)

This is why you should probably stick to Eager loading.

If you still want to know how to do it, Lazy loading was introduced the Coveo JavaScript Search Framework V2, here is the documentation link: Lazy Versus Eager Loading Components

Ask a question