[IMP] developer: document formatters/parsers registries
and add entry for effects registry as well closes odoo/documentation#1300 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit is contained in:
parent
8c79319011
commit
624131f712
@ -106,8 +106,14 @@ Reference List
|
|||||||
|
|
||||||
* - Category
|
* - Category
|
||||||
- Content
|
- Content
|
||||||
|
* - :ref:`effects <frontend/registries/effects>`
|
||||||
|
- implementation for all available effects
|
||||||
|
* - :ref:`formatters <frontend/registries/formatters>`
|
||||||
|
- utility functions to format values (mostly used for field values)
|
||||||
* - :ref:`main_components <frontend/registries/main_components>`
|
* - :ref:`main_components <frontend/registries/main_components>`
|
||||||
- top level components
|
- top level components
|
||||||
|
* - :ref:`parsers <frontend/registries/parsers>`
|
||||||
|
- utility functions to parse values (mostly used for field values)
|
||||||
* - :ref:`services <frontend/registries/services>`
|
* - :ref:`services <frontend/registries/services>`
|
||||||
- all services that should be activated
|
- all services that should be activated
|
||||||
* - :ref:`systray <frontend/registries/systray>`
|
* - :ref:`systray <frontend/registries/systray>`
|
||||||
@ -115,6 +121,35 @@ Reference List
|
|||||||
* - :ref:`user_menuitems <frontend/registries/usermenu>`
|
* - :ref:`user_menuitems <frontend/registries/usermenu>`
|
||||||
- menu items displayed in the user menu (top right of navbar)
|
- menu items displayed in the user menu (top right of navbar)
|
||||||
|
|
||||||
|
.. _frontend/registries/effects:
|
||||||
|
|
||||||
|
Effect registry
|
||||||
|
---------------
|
||||||
|
|
||||||
|
The `effects` registry contains the implementations of all available effects.
|
||||||
|
See the section on the :ref:`effect service <frontend/services/effect_registry>`
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
.. _frontend/registries/formatters:
|
||||||
|
|
||||||
|
Formatter registry
|
||||||
|
------------------
|
||||||
|
|
||||||
|
The `formatters` registry contains functions to format values. Each formatter
|
||||||
|
has the following API:
|
||||||
|
|
||||||
|
.. js:function:: format(value[, options])
|
||||||
|
|
||||||
|
:param value: a value of a specific type, or `false` if no value is given
|
||||||
|
:type value: T | false
|
||||||
|
:param Object options: various options
|
||||||
|
:returns: string
|
||||||
|
|
||||||
|
Formats a value and returns a string
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
- :ref:`Parsers registry <frontend/registries/parsers>`
|
||||||
|
|
||||||
.. _frontend/registries/main_components:
|
.. _frontend/registries/main_components:
|
||||||
|
|
||||||
Main components registry
|
Main components registry
|
||||||
@ -143,6 +178,28 @@ this:
|
|||||||
Component: LoadingIndicator,
|
Component: LoadingIndicator,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
.. _frontend/registries/parsers:
|
||||||
|
|
||||||
|
Parser registry
|
||||||
|
---------------
|
||||||
|
|
||||||
|
The `parsers` registry contains functions to parse values. Each parser
|
||||||
|
has the following API:
|
||||||
|
|
||||||
|
.. js:function:: parse(value[, options])
|
||||||
|
:noindex:
|
||||||
|
|
||||||
|
:param value: a string representing a value
|
||||||
|
:type value: string
|
||||||
|
:param Object options: various options (parser specific)
|
||||||
|
:returns: T a valid value
|
||||||
|
|
||||||
|
Parses a string and returns a value. If the string does not represent a valid
|
||||||
|
value, parsers can fail and throw errors.
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
- :ref:`Formatters registry <frontend/registries/formatters>`
|
||||||
|
|
||||||
.. _frontend/registries/services:
|
.. _frontend/registries/services:
|
||||||
|
|
||||||
Service registry
|
Service registry
|
||||||
@ -245,9 +302,3 @@ Example:
|
|||||||
hide: (Math.random() < 0.5),
|
hide: (Math.random() < 0.5),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Effect registry
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Contains the implementations of all available effects. See the section on the
|
|
||||||
:ref:`effect service <frontend/services/effect_registry>` for more details.
|
|
@ -53,7 +53,7 @@ A service needs to implement the following interface:
|
|||||||
|
|
||||||
.. js:function:: start(env, deps)
|
.. js:function:: start(env, deps)
|
||||||
|
|
||||||
:param Environment env:
|
:param Environment env: the application environment
|
||||||
:param Object deps: all requested dependencies
|
:param Object deps: all requested dependencies
|
||||||
:returns: value of service or Promise<value of service>
|
:returns: value of service or Promise<value of service>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user