annotator.registry package¶
-
class
annotator.registry.
Registry
¶ Registry is an application registry. It serves as a place to register and find shared components in a running
annotator.App
.You won’t usually create your own Registry – one will be created for you by the
App
. If you are writing an Annotator module, you can use the registry to provide or override a component of the Annotator application.For example, if you are writing a module that overrides the “storage” component, you will use the registry in your module’s configure function to register your component:
function myStorage () { return { configure: function (registry) { registry.registerUtility(this, 'storage'); }, ... }; }
-
annotator.registry.Registry.prototype.
registerUtility
(component, iface)¶ Register component component as an implementer of interface iface.
Parameters: - component – The component to register.
- iface (string) – The name of the interface.
-
annotator.registry.Registry.prototype.
getUtility
(iface)¶ Get component implementing interface iface.
Parameters: iface (string) – The name of the interface. Returns: Component matching iface. Throws LookupError: If no component is found for interface iface.
-
annotator.registry.Registry.prototype.
queryUtility
(iface)¶ Get component implementing interface iface. Returns null if no matching component is found.
Parameters: iface (string) – The name of the interface. Returns: Component matching iface, if found; null otherwise.
-
class
annotator.registry.
LookupError
(iface)¶ The error thrown when a registry component lookup fails.