Results/responses to actions are widely represented within the framework using the
An
| Property | Description |
| code | Error (or success) code from |
| isOkay | Derived boolean property indicating whether the |
| isError | Derived boolean property indicating whether the |
An error
Depending on the nature of the response, the
For example, in the response from the standard
Framework.Ask("Are you sure?", function (Msg) {
if (Msg.result) {
if (Msg.result.code == FXB.ErrorCodes.OKAY) {
if (Msg.result.msg == "Yes") {
// User selected the yes button
}
} else {
// User cancelled the dialog without clicking a button
}
} else {
// Message is an interim update from the dialog, not the final result
}
});
However, it's only usually necessary to check for a specific response or do nothing, and so the code above would/could typically be reduced to the following:
Framework.Ask("Are you sure?", function (Msg) {
if (Msg.result && Msg.result.msg == "Yes") {
// User selected the yes button (as opposed to No button, or cancellation without
// response, or an interim update from the dialog rather than a final result)
}
});