Hi all,
I’m having an issue where I need information from a commandStack event as part of a payload in a REST call to a remote server.
In this case, I am listening to the commandStack.shape.move.executed
event, in which I get the event.context.shape.incoming.waypoints
array to use in a REST call:
eventBus.on('commandStack.shape.move.executed', (event) => {
updateShapeOnMove(event); // this makes a REST call
});
However, when I send out the REST call, the event has not updated with the new line waypoints (event.context.shape.incoming.waypoints
). I’ve tried using the .postExecute
and .postExecuted
command stack events without luck. The only successful way I’ve been able to ensure that the referenced event is updated in time for the REST call is by using a timeout:
setTimeout(() => updateShapeOnMove(event), 1000);
I don’t like this solution. Is there a better way to know when the referenced event is updated?