Registry
Table of Contents
Constructor
Registry
()
Methods
Get the lookup directory for internal modules
Parameters:
-
lookup
Stringstring name of object we're looking for (e.g. 'module')
Returns:
directory
Attempts to load modules by requiring them in locally. Lookup directory is determined by the type of object we're loading (e.g. 'module' => ./) and the name of the module (e.g. 'model-manager') which is underscored
Parameters:
Returns:
required module
Inject an object into another object
Parameters:
Returns:
context
Example:
registry.inject(object, "service:store");
// object.store
registry.inject(object, "service:model-manager", "modelManager");
// object.modelManager
Find an object in the registry. If the object isn't found in the registry, lookup will attempt to find it by requiring it in. If the require fails the lookup fails
Parameters:
-
name
Stringcolon delimited lookup string "service:foo"
Returns:
Example:
registry.lookup("service:foo");
Register an object in the registry by name. If the name exists and it was registered with the { singleton: true } option, an error will be thrown.
Parameters:
Returns:
Obj
Example:
registry.register("service:foo", { foo: "bar" });