Hi everyone!
I've implemented component, which needs JavaScript function for proper positioning and I need to set this function as <body>'s "onload" and "onScroll" events. So, I have .js file with my possitioning function and also decorateBody() function which I need to call after page is created. Problem (or let say not-nice) is, that I can call it only (as far as I've tried) via javaScriptSupport.addScript("decorateBody();"); in @AfterRender method. It works, but when I use more of my components in one page, "decorateBody();" call is called x times, where x is number of components on the page. I can also call the function as anonymous directly at js library, but then it goes to error as body tag does not exists in moment of library import. Question 1: Is it possible to specify something "execute only once in page" on component level? (call from page containing the components is not solution for me, I want to have my component "independent") Question 2: Is it possible to load js library AFTER page is created (body tag is rendered)? Everything what I've tried was loading js before body tag exists. Thanks for any help in advance! Best regards Ladislav