I am working on a widget, and I use data/input variables to communicate between the Client script to Server script.
for ex., in the Client Script I use:
c.data.action= "removeEvent";
c.server.update().then(function(){ c.data.action = undefined;});
and I am waiting that action in the Server Script with:
if(input.action == "removeEvent"){
//some code here...
}
My problem is that once I completed that action (in the Server Script) I need to go back to my Client Script to updated the data that is showed to the user and trigger other functions. So, how can I know from the Client Script that the code in the Server Script has ended?
I try to use the data variable again like:
// In Server Script
data.finished = true;
//In client Script
if(data.finished ) {
//do something
}
But, the Client Script doesn't update.
Is there a way to do it with a watcher or subscribe on a variable so when it changes I know that the Server Script has finished?
Thanks all for your help!