register a module service

@param {Object} service consoleService object
@param {String} moduleId adminConsole id/name
@param {Object} module module object
@api private
514089
function registerRecord(service, moduleId, module) {
    const record = {
        moduleId: moduleId,
        module: module,
        enable: false
    };

    if (module.type && module.interval) {
        if (!service.master && record.module.type === 'push' || service.master && record.module.type !== 'push') {// eslint-disable-line
            // push for monitor or pull for master(default)
            record.delay = module.delay || 0;
            record.interval = module.interval || 1;
            // normalize the arguments
            if (record.delay < 0) {
                record.delay = 0;
            }
            if (record.interval < 0) {
                record.interval = 1;
            }
            record.interval = Math.ceil(record.interval);
            record.delay *= MS_OF_SECOND;
            record.interval *= MS_OF_SECOND;
            record.schedule = true;
        }
    }

    return record;
}
55146
public function registerModules($modules = [])
    {
        for($i = 0; $i < sizeof($modules); $i++) {
            $moduleName = $modules[$i];

            $module = $this->createNew($moduleName);

            if (!$module instanceof ModuleInterface) {
                throw new InvalidModuleException('The module at position '.($i+1).' is invalid');
            }

            $serviceProvider = $module->getServiceProvider();
            $this->getContainer()->registerServices($serviceProvider);
        }
    }
224087
def register_module(self, module, namespace=None):
        
        namespace = namespace if namespace is not None else module \
            if isinstance(module, str) else module.__name__
        self.register_namespace(namespace, module)
1298904
protected function registerConsole()
    {
        /*
         * Allow plugins to use the scheduler
         */
        Event::listen('console.schedule', function ($schedule) {
            $plugins = PluginManager::instance()->getPlugins();
            foreach ($plugins as $plugin) {
                if (method_exists($plugin, 'registerSchedule')) {
                    $plugin->registerSchedule($schedule);
                }
            }
        });

        /*
         * Add CMS based cache clearing to native command
         */
        Event::listen('cache:cleared', function () {
            \System\Helpers\Cache::clearInternal();
        });

        /*
         * Register console commands
         */
        $this->registerConsoleCommand('october.up', 'System\Console\OctoberUp');
        $this->registerConsoleCommand('october.down', 'System\Console\OctoberDown');
        $this->registerConsoleCommand('october.update', 'System\Console\OctoberUpdate');
        $this->registerConsoleCommand('october.util', 'System\Console\OctoberUtil');
        $this->registerConsoleCommand('october.mirror', 'System\Console\OctoberMirror');
        $this->registerConsoleCommand('october.fresh', 'System\Console\OctoberFresh');
        $this->registerConsoleCommand('october.env', 'System\Console\OctoberEnv');
        $this->registerConsoleCommand('october.install', 'System\Console\OctoberInstall');

        $this->registerConsoleCommand('plugin.install', 'System\Console\PluginInstall');
        $this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove');
        $this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh');

        $this->registerConsoleCommand('theme.install', 'System\Console\ThemeInstall');
        $this->registerConsoleCommand('theme.remove', 'System\Console\ThemeRemove');
        $this->registerConsoleCommand('theme.list', 'System\Console\ThemeList');
        $this->registerConsoleCommand('theme.use', 'System\Console\ThemeUse');
    }
325770
function (module) {
    
        var templates = {};
    
        this.register = function (path, template) {
    
            if (templates[path]) {
                console.error('template "' + path + '" is already registered in module "' + module.ID + '"');
            }
    
            templates[path] = template;
    
        };
    
        this.render = function (path, params) {
    
            if (!templates[path]) {
                console.error('invalid template path: "' + path + '"');
                return '';
            }
    
            return templates[path].render(params);
    
        };
    
    }
661602
def _RegisterFlagByModuleId(self, module_id, flag):
    
    flags_by_module_id = self.FlagsByModuleIdDict()
    flags_by_module_id.setdefault(module_id, []).append(flag)
910203
function initModule(modName, mod) {
        console.log("Initialising "+modName);
        if (mod.init !== undefined)
          mod.init();
      }
706507
function(moduleId) {
		var scriptEl = document.createElement('script');
		scriptEl.type = 'text/javascript';
		scriptEl.src = resolveModuleUri(moduleId);

		var useStandard = !!scriptEl.addEventListener,
			timeoutHandle;

		var errorFunc = function() {
			postLoadFunc(false);
		};

		var loadFunc = function() {
			if (useStandard || (scriptEl.readyState == 'complete' || scriptEl.readyState == 'loaded')) {
				postLoadFunc(getModule(moduleId).defined);
			}
		};

		var postLoadFunc = function(loaded) {
			clearTimeout(timeoutHandle);

			if (useStandard) {
				scriptEl.removeEventListener('load', loadFunc, false);
				scriptEl.removeEventListener('error', errorFunc, false);
			}
			else {
				scriptEl.detachEvent('onreadystatechange', loadFunc);
			}

			if (!loaded) {
				var module = getModule(moduleId);
				if (!module.defined) {
					module.defined = module.error = true;
					fireCallbacks();
				}
			}
		};

		if (useStandard) {
			scriptEl.addEventListener('load', loadFunc, false);
			scriptEl.addEventListener('error', errorFunc, false);
		}
		else {
			scriptEl.attachEvent('onreadystatechange', loadFunc);
		}

		timeoutHandle = setTimeout(errorFunc, _timeoutLength);

		head.appendChild(scriptEl);
	}
273799
function registerModuleFactory(id, factory) {
    var existing = moduleFactories.get(id);
    if (existing) {
        throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
    }
    moduleFactories.set(id, factory);
}
966994
function register (options, __mockSelf) {
  var _self = __mockSelf || self
  var navigator = _self.navigator

  if (!('serviceWorker' in navigator)) {
    return Promise.reject(new Error('Service Workers unsupported'))
  }

  var serviceWorker = navigator.serviceWorker.controller

  return Promise.resolve()
    .then(function () {
      // Get existing service worker or get registration promise
      if (serviceWorker) return serviceWorker
      else if (!options) return navigator.serviceWorker.ready
    })
    .then(function (registration) {
      if (registration) {
        // Take this service worker that the registration returned
        serviceWorker = registration
      } else if (!registration && options) {
        // No registration but we have options to register one
        return navigator.serviceWorker
          .register(options.url, options)
          .then(function (registration) {
            options.forceUpdate && registration.update()
          })
      } else if (!registration && !options) {
        // No existing worker,
        // no registration that returned one,
        // no options to register one
        throw new Error('no active service worker or configuration passed to install one')
      }
    })
    .then(function () {
      return serviceWorker
    })
}
298122
function setModuleConfig(moduleConfig) {
                    if (!angular.isObject(moduleConfig)) {
                        throw new Error('You need to give the module config object to set');
                    }
                    modules[moduleConfig.name] = moduleConfig;
                    return moduleConfig;
                }
223891
private void registerModule(String[] packageList)
  {
    if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.entry(_tc, "registerModule", new Object[] { this, packageList });

    for (int i = 0, rc = 0;(rc == 0) && (i < packageList.length); i++)
    {
      if (TraceComponent.isAnyTracingEnabled() && _tc.isDebugEnabled()) SibTr.debug(_tc, "Registering diagnostic module " + this +" for package: " + packageList[i]);

      rc = FFDC.registerDiagnosticModule(this, packageList[i]);

      if (rc != 0)
      {
        if (TraceComponent.isAnyTracingEnabled() && _tc.isDebugEnabled()) SibTr.debug(_tc, "Registration failed, return code=" + rc);
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && _tc.isEntryEnabled()) SibTr.exit(_tc, "registerModule");
  }
581601
public function registerService(Service\Serviceable $service, Service\Configurable $config)
    {
        $service->register($this->container, $config);
    }
1002058
function(serviceRegistry, setup) {
	this._setup = setup;
	this._projectClient = serviceRegistry.getService("orion.project.client");
	serviceRegistry.registerService("orion.edit.hover", this, {
		name: 'Hover Evaluation',
		contentType: ["application/javascript", "text/x-c++src", "text/x-python"] // TODO: get by sub-services
	});
}
333736
function DeclareModule(node, print) {
  this.push("declare module ");
  print.plain(node.id);
  this.space();
  print.plain(node.body);
}
823726
function Service(opts) {
  _.extend(this,
    {
      description: '',
      utils: require('./utils'),
      logger: require('./logger')
    },
    require('./config')(),
    opts
  );

  // scoped modules contain a '/' (@foo/bar).
  // this causes problems when generating logs/scripts
  // on some platforms.
  this.name = this.name.replace('/', '_');

  // run the script within its ndm
  // node_modules directory.
  this.workingDirectory = this._workingDirectory();

  this.logFile = this.utils.resolve(
    this.logsDirectory,
    this.name + '.log'
  );

  this._copyFieldsFromPackageJson(); // try to grab some sane defaults from package.json.
}
1237180
function addService(service, serviceObject){

    client.get('uServices', function(err, reply) {

        if (reply == null){
            //extend this object
            //add a key with service name and value service channel
            //this is the first service i should activate it
            var newObjectToPush = JSON.parse('{"' + service + '": []}');//found a fancy way to make this
            serviceObject.status = 1;
            newObjectToPush[service].push(serviceObject);

            extend(uServices, newObjectToPush);

            setAndPublish('uServices',uServices,'uServicesChannel', 'UPDATE')

        } else {
            uServices = JSON.parse(reply);
            if (typeof(uServices[service]) !== 'undefined') {

                var uService = uServices[service];
                uService.push(serviceObject);
                //save the new uServices
                uServices[service] = uService;

                setAndPublish('uServices',uServices,'uServicesChannel', 'UPDATE')

            } else {
                //extend this object
                //add a key with service name and value service channel
                var stringObject = '{"' + service + '": []}'; //found a fancy way to make this
                var objectToPush = JSON.parse(stringObject);
                objectToPush[service].push(serviceObject);
                extend(uServices, objectToPush);

                setAndPublish('uServices',uServices,'uServicesChannel', 'UPDATE')
            }
        }
    });
}