On 15/04/2015 11:02, Patrick Davids wrote:
Hi all,

is there something included as feature in Wickets HeaderItems, what I can use as kind of client-side javascript observer-listener pattern?

For instance... I have components which relies on a on-dom-ready previous executed javascript, before the components internal javascripts can be executed.

So, its a kind of mix of PriorityHeaderItem and OnDomReadyHeaderItem and fire mechanism, when the scripts with priority has been successfully executed.

I would like to implement this feature as behavior, so multiple components on a page can have this pre-executed-javascript-behavior, and listen for a javascript "execution done" event.
Have considered yet to use resource dependencies. You might create a resource specifying which resource it depends on must be rendered first. Than you can render it in your custom behavior. See chapter '16.6 Resource dependencies' of user guide.

This javascript-code should also applied to the page only once, independently how often the behavior is added to my different components on page.

I also need some sort of subscription code on javascript-side to get notified.

To avoid multiple rendering of the same header item, class HeaderItem uses method getRenderTokens to check if the item has already been rendered. So if your heder item doesn't change (for example, the javascript code is always the same) it won't be rendered more than once.

I already have some ideas to implement this, but would like to ask for framework-features or other inspirations, best practices or ideas, first.

Thanx for feedback!
Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to