How do I include a JavaScript code only once for multiple usages of a composite component on a page?
Initially I had put I put the JS code inside the cc:impl
cc:impl
Include the static part of that JS code as a standalone JS file by <h:outputScript> with target="head". It'll be rendered into <h:head> just once.
target="head"
<h:head>
<cc:implementation> <h:outputScript name="js/myCompositeHelper.js" target="head" /> ... </cc:implementation>