How can we integrate this into vaadin ?
I ve looked all samples very complex seems like.
For ex:
PlaySound ps = new PlaySound(0,new ExternalResource(“audio/flute_c_long_01.wav”));
PlaySound ps2 = new PlaySound(0,new ExternalResource(“audio/piano_chord.wav”));
Hi, mostly the way to integrate JavaScript implementation is the same as for GWT. In essence that is the
JSNI . In addition to that, Vaadin uses server-side component architecture you want to implement to make your code more reusable. Take a look the
Chapter 10 in the Book of Vaadin to get your GWT code integrated with Vaadin.
It may feel like a complex task to create components like this, but it is a very good practice. If you know that you just need a quick hack and you are only developing for yourself (i.e. nothing reusable), you can take a shortcut and try with the Vaadin’s
JavaScript API just to call the methods you need.
Given the length of the javascript code, I would personally refrain from using the Javascript API. In my perspective, even though the JS code will be inserted into the output HTML page by the API, there are some circumstances that can bring surprise to the developers (for e.g.: namespace clutter and global var pollution).
I think that Vaadin is not javascript friendly. But I can understand this since Vaadin uses different approach to handling the interaction at the client side.