lib/loader.js
function() {
            var loader = this;
            return {
                //callback is optional, but will guarantee module was initialized
                get: function(name, callback) {
                    if (!_.isString(name)) {
                        debug('To get a registered service, the service name must be provided.');
                        return;
                    }

                    var normalizedName = normalizeServiceName(name);
                    if (!callback) { //sync version
                        if (!_.includes(initMods, normalizedName)) { //hasn't been initialized
                            debug('Using services.get on %s before it has been initialized.', name);
                        }
                        return loader.get(normalizedName);

                    } else { //async version
                        if (_.includes(initMods, normalizedName)) { //already initialized
                            debug('Found already-initialized module %s, invoking callback.', name);
                            return callback(loader.get(normalizedName));
                        } else {
                            debug('Adding callback %s to notify list for service %s', (callback.name || '<anonymous>'),
                                name);
                            notifyList.push({name: normalizedName, callback: callback});
                        }
                    }
                }
            };
        }
function() {
            var loader = this;
            return {
                //callback is optional, but will guarantee module was initialized
                get: function(name, callback) {
                    if (!_.isString(name)) {
                        debug('To get a registered service, the service name must be provided.');
                        return;
                    }

                    var normalizedName = normalizeServiceName(name);
                    if (!callback) { //sync version
                        if (!_.includes(initMods, normalizedName)) { //hasn't been initialized
                            debug('Using services.get on %s before it has been initialized.', name);
                        }
                        return loader.get(normalizedName);

                    } else { //async version
                        if (_.includes(initMods, normalizedName)) { //already initialized
                            debug('Found already-initialized module %s, invoking callback.', name);
                            return callback(loader.get(normalizedName));
                        } else {
                            debug('Adding callback %s to notify list for service %s', (callback.name || '<anonymous>'),
                                name);
                            notifyList.push({name: normalizedName, callback: callback});
                        }
                    }
                }
            };
        }
function ( ) { var loader = this ; return { //callback is optional, but will guarantee module was initialized get : function ( name , callback ) { if ( ! _ . isString ( name ) ) { debug ( 'To get a registered service, the service name must be provided.' ) ; return ; } var normalizedName = normalizeServiceName ( name ) ; if ( ! callback ) { //sync version if ( ! _ . includes ( initMods , normalizedName ) ) { //hasn't been initialized debug ( 'Using services.get on %s before it has been initialized.' , name ) ; } return loader . get ( normalizedName ) ; } else { //async version if ( _ . includes ( initMods , normalizedName ) ) { //already initialized debug ( 'Found already-initialized module %s, invoking callback.' , name ) ; return callback ( loader . get ( normalizedName ) ) ; } else { debug ( 'Adding callback %s to notify list for service %s' , ( callback . name || '<anonymous>' ) , name ) ; notifyList . push ( { name : normalizedName , callback : callback } ) ; } } } } ; }
This is what we would expose for apps to use to manually load services
This is what we would expose for apps to use to manually load services