react-backbone.js
function pushLoadingState(xhrEvent, stateName, modelOrCollection, context, force) {
        var currentLoads = getState(stateName, context),
            currentlyLoading = currentLoads && currentLoads.length;
        if (!currentLoads) {
            currentLoads = [];
        }
        if (_.isArray(currentLoads)) {
            if (_.indexOf(currentLoads, xhrEvent) >= 0) {
                if (!force) {
                    return;
                }
                
            } else {
                currentLoads.push(xhrEvent);
            }
            
            if (!currentlyLoading) {
                var toSet = {};
                toSet[stateName] = currentLoads;
                setState(toSet, context);
            }

            xhrEvent.on('complete', function() {
                popLoadingState(xhrEvent, stateName, modelOrCollection, context);
            });
        }
    }
function pushLoadingState(xhrEvent, stateName, modelOrCollection, context, force) {
        var currentLoads = getState(stateName, context),
            currentlyLoading = currentLoads && currentLoads.length;
        if (!currentLoads) {
            currentLoads = [];
        }
        if (_.isArray(currentLoads)) {
            if (_.indexOf(currentLoads, xhrEvent) >= 0) {
                if (!force) {
                    return;
                }
                
            } else {
                currentLoads.push(xhrEvent);
            }
            
            if (!currentlyLoading) {
                var toSet = {};
                toSet[stateName] = currentLoads;
                setState(toSet, context);
            }

            xhrEvent.on('complete', function() {
                popLoadingState(xhrEvent, stateName, modelOrCollection, context);
            });
        }
    }
function pushLoadingState ( xhrEvent , stateName , modelOrCollection , context , force ) { var currentLoads = getState ( stateName , context ) , currentlyLoading = currentLoads && currentLoads . length ; if ( ! currentLoads ) { currentLoads = [ ] ; } if ( _ . isArray ( currentLoads ) ) { if ( _ . indexOf ( currentLoads , xhrEvent ) >= 0 ) { if ( ! force ) { return ; } } else { currentLoads . push ( xhrEvent ) ; } if ( ! currentlyLoading ) { var toSet = { } ; toSet [ stateName ] = currentLoads ; setState ( toSet , context ) ; } xhrEvent . on ( 'complete' , function ( ) { popLoadingState ( xhrEvent , stateName , modelOrCollection , context ) ; } ) ; } }
loading state helpers
loading state helpers