Updating Inputs From Server
- Define the setValue method.
- Define the receiveMessage method.
receiveMessage: function(el, data) {
console.log(data);
if (data.hasOwnProperty('value')) {
this.setValue(el, data.value);
}
// other parameters to update...
}
Where:
el
is the DOM element.value
represents the new value.data
are received from R as JS object
It is good practice to add a
data.hasOwnProperty
check to avoid running code if the specified property does not exist.