aura:waiting

Indicates that the app is waiting for a response to a server request. This event is fired before aura:doneWaiting.
Note

Note

We don't recommend using the legacy aura:waiting event except as a last resort. The aura:waiting application event is fired for every server request, even for requests from other components in your app. Unless your component is running in complete isolation in a standalone app and not included in Lightning Experience or Salesforce1, you probably don’t want to handle this application event. The container app may fire server-side actions and trigger your event handler multiple times.

This event is automatically fired when a server-side action is added using $A.enqueueAction() and subsequently run, or when it’s expecting a response from an Apex controller. The aura:waiting event is handled by a client-side controller. A component can have only one <aura:handler> tag to handle this event.
<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
This example shows a spinner when aura:waiting is fired.
<aura:component>
     <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
    <!-- Other component markup here -->
    <center><ui:spinner aura:id="spinner"/></center>
</aura:component>
This client-side controller fires an event that displays the spinner.
({
    showSpinner : function (component, event, helper) {
        var spinner = component.find('spinner');
        var evt = spinner.get("e.toggle");
        evt.setParams({ isVisible : true });
        evt.fire();    
    }
})
The aura:waiting handler contains these required attributes.
Attribute Name Type Description
event String The name of the event, which must be set to aura:waiting.
action Object The client-side controller action that handles the event.