Hi,
Basically, the setCallback() function sets a function to run after the action finishes. You might be wondering why we can’t just call getReturnValue() on the action right after enqueuing it and why the setCallback() function is even necessary.
setCallback() has a third parameter that registers the action state that will invoke the callback. If you don’t specify the third argument for setCallback() , it defaults to registering the SUCCESS and ERROR states. To set a callback for another state, such as ABORTED , you can call setCallback() multiple times with the action state set explicitly in the third argument. For example:
action.setCallback(this, function(response) { …}, “ABORTED”);
Hope this helps.