Vaadin 7 : Including Javascript - checking


I’m porting some internal client side components/widgets from Vaadin v6 to Vaadin v7. In a a couple, we’re using JQuery, which we’re expliclty including in the Application#writeAjaxHeader

Of course, in V7 we can use @Javascript annotation/BootStrapListener to include the javascript files.

But - what is the “correct” way to ensure that the library is only included once?

In this example, I want to use JQuery - so I can include the jquery.min.js and use @Javascript(“jquery.min.js”) and tada! But - I’m going to use Vaadin Charts too. It uses JQuery as well. How does one ensure that it’s only included once?

Or doesn’t it matter?

If I was going to publish an Add-On, I wouldn’t know whether or not JQuery had already been included…



Edited to add: I’ve just looked at the source of the Vaadin Charts add-on, and can see that it only injects JQuery if it needs to. I think my question still stands, though, as a “general” one.