Skip to content

Commit 33b9bb3

Browse files
committed
1 parent 972d597 commit 33b9bb3

19 files changed

+114
-131
lines changed

doc/api/app.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ annotator package
6060

6161
.. function:: annotator.App.extend(object)
6262

63-
Create a new object which inherits from the App class.
63+
Create a new object that inherits from the App class.
6464

65-
For example, here we create a ``CustomApp`` which will include the
65+
For example, here we create a ``CustomApp`` that will include the
6666
hypothetical ``mymodules.foo.bar`` module depending on the options object
6767
passed into the constructor::
6868

doc/api/notification.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ annotator.notifier package
1414
`notification.SUCCESS`, or `notification.ERROR`)
1515

1616
:returns:
17-
An object with a `close` method which can be used to close the banner.
17+
An object with a `close` method that can be used to close the banner.
1818

1919

doc/api/registry.rst

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,24 @@ annotator.registry package
77

88
`Registry` is an application registry. It serves as a place to register and
99
find shared components in a running :class:`annotator.App`.
10-
10+
1111
You won't usually create your own `Registry` -- one will be created for you
12-
by the :class:`~annotator.App`. If you are writing an Annotator module, there
13-
are, broadly, two main scenarios in which you will need to interact with the
14-
registry.
15-
16-
1. If you are writing a module which overrides some default component, such
17-
as the "storage" component, you will use the registry in your module's
18-
`configure` function to register your component::
19-
20-
function myStorage () {
21-
return {
22-
configure: function (registry) {
23-
registry.registerUtility(this, 'storage');
24-
},
25-
...
26-
};
27-
}
28-
29-
2. If your module needs to interact with some of the core components of the
30-
`App`, then you will find these exposed on the `Registry` instance. For
31-
example, if your module needs to send a notification when the application
32-
starts, you can use the "notifier" component which is exposed as the
33-
``notify()`` function on the registry::
34-
35-
function myModule () {
36-
return {
37-
start: function (registry) {
38-
registry.notify("Hello, world!");
39-
},
40-
...
41-
};
42-
}
12+
by the :class:`~annotator.App`. If you are writing an Annotator module, you
13+
can use the registry to provide or override a component of the Annotator
14+
application.
15+
16+
For example, if you are writing a module that overrides the "storage"
17+
component, you will use the registry in your module's `configure` function to
18+
register your component::
19+
20+
function myStorage () {
21+
return {
22+
configure: function (registry) {
23+
registry.registerUtility(this, 'storage');
24+
},
25+
...
26+
};
27+
}
4328

4429

4530
.. function:: annotator.registry.Registry.prototype.registerUtility(component, iface)

0 commit comments

Comments
 (0)