I have an application that contains an editor for business data. It is written as a non-Vaadin JavaScript component, which fires an event via DOM.dispatchEvent when a field was edited. These “ContentChanged-Events” are caught on the server side by Vaadin and the business object is updated.
Then there is a save button, which is a Vaadin component. The event that is sent upon click of the save button is also processed on the server, but sometimes this event arrives after the “ContentChanged-Event” and the business object is saved before it is updated.
Since the DOM dispatchEvent function is guaranteed to be synchronous, how can the Vaadin event overtake it?
https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-dispatchEvent
Is there anything I can do to guarantee the correct order of events?