middleware/mw.service.init.js
function initReactors(container) {
        var isBatch = container === 'batch';

        // loop through each reactor and call init if it exists
        _.each(reactors, function (reactor) {
            if (reactor.init) {
                reactor.init({ config: config, pancakes: pancakes });
            }
        });

        // most reactors will be through the resource reactor definitions
        _.each(resources, function (resource) {                     // loop through all the resources
            _.each(resource.reactors, function (reactData) {        // loop through reactors
                if (isBatch && reactData.type === 'audit') {        // don't do anything if audit for batch
                    return;                                         // since audit not needed for batch
                }

                var eventTriggers = {                               // events that will trigger this propgation
                    resources:  [resource.name],
                    adapters:   reactData.trigger.adapters,
                    methods:    reactData.trigger.methods
                };

                // add the event handler
                eventBus.addHandlers(eventTriggers, reactHandler(reactData));
            });
        });
    }
function initReactors(container) {
        var isBatch = container === 'batch';

        // loop through each reactor and call init if it exists
        _.each(reactors, function (reactor) {
            if (reactor.init) {
                reactor.init({ config: config, pancakes: pancakes });
            }
        });

        // most reactors will be through the resource reactor definitions
        _.each(resources, function (resource) {                     // loop through all the resources
            _.each(resource.reactors, function (reactData) {        // loop through reactors
                if (isBatch && reactData.type === 'audit') {        // don't do anything if audit for batch
                    return;                                         // since audit not needed for batch
                }

                var eventTriggers = {                               // events that will trigger this propgation
                    resources:  [resource.name],
                    adapters:   reactData.trigger.adapters,
                    methods:    reactData.trigger.methods
                };

                // add the event handler
                eventBus.addHandlers(eventTriggers, reactHandler(reactData));
            });
        });
    }
function initReactors ( container ) { var isBatch = container === 'batch' ; // loop through each reactor and call init if it exists _ . each ( reactors , function ( reactor ) { if ( reactor . init ) { reactor . init ( { config : config , pancakes : pancakes } ) ; } } ) ; // most reactors will be through the resource reactor definitions _ . each ( resources , function ( resource ) { // loop through all the resources _ . each ( resource . reactors , function ( reactData ) { // loop through reactors if ( isBatch && reactData . type === 'audit' ) { // don't do anything if audit for batch return ; // since audit not needed for batch } var eventTriggers = { // events that will trigger this propgation resources : [ resource . name ] , adapters : reactData . trigger . adapters , methods : reactData . trigger . methods } ; // add the event handler eventBus . addHandlers ( eventTriggers , reactHandler ( reactData ) ) ; } ) ; } ) ; }
Call all reactor init functions and attach reactors based
on reactor data within resource files.
@param container
Call all reactor init functions and attach reactors based on reactor data within resource files .