app-registry

A registry tool to set and share application services.

Usage no npm install needed!

<script type="module">
  import appRegistry from 'https://cdn.skypack.dev/app-registry';
</script>

README

App Registry

A registry tool to set and share application services.

var registry = require('app-registry');
function serviceOne() {
  console.log('This is the service one');
}

registry.register('firstService', serviceOne);


// Somewere in the app (in another file)
var theServiceINeed = registry.get('firstService');
theServiceINeed();

API

getRegistered()

Return the list of registered services.

register(serviceName, service)

Register a new service.

get(serviceName)

Get the service with name serviceName.
Throw an exception if the service doesn't exists.

exists(serviceName)

Check if the the service with name serviceName exists

unset(serviceName)

Unset if the the service with name serviceName from the registry.

reset()

Remove all services from registry. Useful in the test environment.