Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
node.js service locator to perform inversion of control
JavaScript
branch: master
Failed to load latest commit information.
test
.gitignore
.jshintrc
README.md
package.json
service-locator.js

README.md

service-locator - A simple service locator for JavaScript

service-locator helps keep your system decoupled by providing a central registry where your application information can be found by other parts of you application.

Service Locator on wikipedia

Installation

 npm install service-locator

Usage

Register your functions, objects, string etc using register(). Once registered with the service locator there is no way to change it.

var serviceLocator = require('service-locator')()
  , foo = 'bar'

serviceLocator.register('foobar', foo)

console.log(serviceLocator.foobar) // bar

serviceLocator.register('logger', console)

serviceLocator.logger.log('Hello world') // Hello world

Credits

Paul Serby

Licence

Licenced under the New BSD License

Something went wrong with that request. Please try again.