I would like my GWT widget to be notified when its CSS animation is over.
In plain HTML/Javascript this is easily done by registering an event handler like so:
elem.addEventListener("webkitAnimationEnd", function(){
// do something
}, false);
// add more for Mozilla etc.
How can I do this in GWT?
This type of event is unknown to GWT's DOMImpl
classes, so I keep getting an error "Trying to sink unknown event type webkitAnimationEnd".
Thanks!
Based on Darthenius' answer and Clay Lenhart's Blog, I finally settled for this solution:
The
CbAnimationEndHandlerIF
is a simple customEventHandler
interface:Works like a charm! Thanks Darthenius!
If anyone can spot a weakness in this, of course I'd be happy to know.
You can always write some of the native (JavaScript) code yourself:
I haven't tried the code above. Let me know if it works as expected.
You can use GWT's Animation class to achieve the same effect. For example,
I expanded a bit on the solution from Darthenius. This code also includes a mechanism to remove the event handler when it is finished. This is what I needed for my application but may not be what you want in all contexts. YMMV!
My final code looks like this: