Skip to content

Commit 624131f

Browse files
committed
[IMP] developer: document formatters/parsers registries
and add entry for effects registry as well closes #1300 Signed-off-by: Géry Debongnie (ged) <[email protected]>
1 parent 8c79319 commit 624131f

File tree

2 files changed

+58
-7
lines changed

2 files changed

+58
-7
lines changed

content/developer/reference/frontend/registries.rst

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,50 @@ Reference List
106106

107107
* - Category
108108
- Content
109+
* - :ref:`effects <frontend/registries/effects>`
110+
- implementation for all available effects
111+
* - :ref:`formatters <frontend/registries/formatters>`
112+
- utility functions to format values (mostly used for field values)
109113
* - :ref:`main_components <frontend/registries/main_components>`
110114
- top level components
115+
* - :ref:`parsers <frontend/registries/parsers>`
116+
- utility functions to parse values (mostly used for field values)
111117
* - :ref:`services <frontend/registries/services>`
112118
- all services that should be activated
113119
* - :ref:`systray <frontend/registries/systray>`
114120
- components displayed in the systray zone in the navbar
115121
* - :ref:`user_menuitems <frontend/registries/usermenu>`
116122
- menu items displayed in the user menu (top right of navbar)
117123

124+
.. _frontend/registries/effects:
125+
126+
Effect registry
127+
---------------
128+
129+
The `effects` registry contains the implementations of all available effects.
130+
See the section on the :ref:`effect service <frontend/services/effect_registry>`
131+
for more details.
132+
133+
.. _frontend/registries/formatters:
134+
135+
Formatter registry
136+
------------------
137+
138+
The `formatters` registry contains functions to format values. Each formatter
139+
has the following API:
140+
141+
.. js:function:: format(value[, options])
142+
143+
:param value: a value of a specific type, or `false` if no value is given
144+
:type value: T | false
145+
:param Object options: various options
146+
:returns: string
147+
148+
Formats a value and returns a string
149+
150+
.. seealso::
151+
- :ref:`Parsers registry <frontend/registries/parsers>`
152+
118153
.. _frontend/registries/main_components:
119154

120155
Main components registry
@@ -143,6 +178,28 @@ this:
143178
Component: LoadingIndicator,
144179
});
145180
181+
.. _frontend/registries/parsers:
182+
183+
Parser registry
184+
---------------
185+
186+
The `parsers` registry contains functions to parse values. Each parser
187+
has the following API:
188+
189+
.. js:function:: parse(value[, options])
190+
:noindex:
191+
192+
:param value: a string representing a value
193+
:type value: string
194+
:param Object options: various options (parser specific)
195+
:returns: T a valid value
196+
197+
Parses a string and returns a value. If the string does not represent a valid
198+
value, parsers can fail and throw errors.
199+
200+
.. seealso::
201+
- :ref:`Formatters registry <frontend/registries/formatters>`
202+
146203
.. _frontend/registries/services:
147204

148205
Service registry
@@ -245,9 +302,3 @@ Example:
245302
hide: (Math.random() < 0.5),
246303
};
247304
}
248-
249-
Effect registry
250-
---------------
251-
252-
Contains the implementations of all available effects. See the section on the
253-
:ref:`effect service <frontend/services/effect_registry>` for more details.

content/developer/reference/frontend/services.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ A service needs to implement the following interface:
5353

5454
.. js:function:: start(env, deps)
5555

56-
:param Environment env:
56+
:param Environment env: the application environment
5757
:param Object deps: all requested dependencies
5858
:returns: value of service or Promise<value of service>
5959

0 commit comments

Comments
 (0)