Lets say our client opens up his fancy profile page. We need to fetch the profile data from the server to paste the informations into our client ui.
In javascript frameworks we would simply run a asynchron post/get operation to wait for the servers data... this looks like this.
Code: Select all
// Make a request for a user with a given ID
axios.get('/user?ID=12345').then(
function (response) {
// Unwrap packet and update the ui.
}
)
Simple right ? We just communicate with a certain url, pass some data... wait till we receive something and update the ui.
In SFSX however we need to send a extension request with a optional packet. The server reponse however is received somewhere else...
Code: Select all
void SomeMethod() {
sfs.addEventListener(SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse);
// Send two integers to the Zone extension and get their sum in return
ISFSObject params = SFSObject.NewInstance();
sfs.Send( new ExtensionRequest("add", params) );
}
void OnExtensionResponse(BaseEvent evt) {
String cmd = (String)evt.Params["cmd"];
if (cmd == "add") {
// Update ui
}
}
This is actually pretty bad for most UI development which relies on sfsx... could you please add some sort of async extension ? Like this ?
Code: Select all
void SomeMethod() {
// Send two integers to the Zone extension and get their sum in return
ISFSObject params = SFSObject.NewInstance();
sfs.Send( new ExtensionRequest("add", params)).then((reponse) => { // Update UI })
}
This does not need to replace the already existing workflow. But it would ease the development for many, many different tasks alot !