[IMP] developer: use js domain for registry page
This commit update the registry documentation to use the js domain directives instead of trying to format functions with code blocks. I am not impressed with the way it looks, but in any cases, it is certainly better to properly structure the documentation. closes odoo/documentation#1245 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit is contained in:
parent
a2a389688c
commit
ce96d6c584
@ -34,76 +34,66 @@ in such a way from one root registry, exported in `@web/core/registry`.
|
|||||||
Registry API
|
Registry API
|
||||||
============
|
============
|
||||||
|
|
||||||
constructor()
|
.. js:class:: Registry()
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
@returns {Registry}
|
Creates a new registry. Note that a registry is an event bus, so one can
|
||||||
|
listen to the `UPDATE` event if necessary. Registries are ordered: the
|
||||||
|
:js:meth:`getAll <Registry.getAll>` method returns a list of
|
||||||
|
values ordered according to their sequence number.
|
||||||
|
|
||||||
creates a new registry. Note that a registry is an event bus, so one can
|
.. js:method:: add(key, value[, options])
|
||||||
listen to the `UPDATE` event if necessary.
|
|
||||||
|
|
||||||
Registries are ordered: the :ref:`getAll <javascript/registries/api/getAll>` method returns a list of values ordered
|
:param string key: key for the new entry
|
||||||
according to their sequence number.
|
:param any value: value for the new entry
|
||||||
|
:param Object options: options
|
||||||
|
:param boolean [options.force]: do not throw if key already exists
|
||||||
|
:param number [options.sequence]: sequence number (useful to order entries)
|
||||||
|
:returns: Registry
|
||||||
|
|
||||||
add(key, value, options)
|
Inserts a value at a specific key. If the key is already used, this method
|
||||||
.. code-block::
|
throws an error (unless the option `force` is set to true). The option
|
||||||
|
`sequence` is useful to insert the value at a specific position. This method
|
||||||
|
also triggers an `UPDATE` event.
|
||||||
|
|
||||||
@param {string} key
|
Returns the same registry, so `add` method calls can be chained.
|
||||||
@param {any} value
|
|
||||||
@param {{force?: boolean, sequence?: number}} [options]
|
|
||||||
@returns {Registry}
|
|
||||||
|
|
||||||
Inserts a value at a specific key. If the key is already used, this method
|
.. js:method:: get(key[, defaultValue])
|
||||||
throws an error (unless the option `force` is set to true). The option
|
|
||||||
`sequence` is useful to insert the value at a specific position. This method
|
|
||||||
also triggers an `UPDATE` event.
|
|
||||||
|
|
||||||
Returns the same registry, so `add` method calls can be chained.
|
:param string key: key for the entry
|
||||||
|
:param defaultValue any: return value if no entry for key exists
|
||||||
|
|
||||||
get(key, defaultValue)
|
Returns the value corresponding to the `key` argument. If the registry does
|
||||||
.. code-block::
|
not contain that key, this method returns `defaultValue` if given, or throws
|
||||||
|
an error otherwise.
|
||||||
|
|
||||||
@param {string} key
|
.. js:method:: contains(key)
|
||||||
@returns {any}
|
|
||||||
|
|
||||||
Returns the value corresponding to the `key` argument. If the registry does
|
:param string key: key for the entry
|
||||||
not contain that key, this method returns `defaultValue` if given, or throws
|
:returns: boolean
|
||||||
an error otherwise.
|
|
||||||
|
|
||||||
contains(key)
|
Returns `true` if `key` is present in the registry
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
@param {string} key
|
.. js:method:: getAll()
|
||||||
@returns {boolean}
|
|
||||||
|
|
||||||
Returns `true` if the `key` is present in the registry
|
:returns: any[]
|
||||||
|
|
||||||
.. _javascript/registries/api/getAll:
|
Returns the list of all elements in the registry. It is ordered
|
||||||
|
according to the sequence numbers.
|
||||||
|
|
||||||
getAll()
|
.. js:method:: remove(key)
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
@returns {any[]}
|
:param string key: the key for the entry that should be removed
|
||||||
|
|
||||||
Returns the list of all elements in the registry. Note that it is ordered
|
Removes a key/value pair from the registry. This operation triggers an
|
||||||
according to the sequence numbers.
|
`UPDATE` event.
|
||||||
|
|
||||||
remove(key)
|
.. js:method:: category(subcategory)
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
@param {string} key
|
:param string subcategory: the name for the sub category
|
||||||
|
:returns: Registry
|
||||||
|
|
||||||
Removes a key/value pair from the registry. This operation triggers an
|
Returns the sub registry associated with the `subcategory`. If it does not
|
||||||
`UPDATE` event.
|
exist yet, the sub registry is created on the fly.
|
||||||
|
|
||||||
category(subcategory)
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
@param {string} subcategory
|
|
||||||
@returns {Registry}
|
|
||||||
|
|
||||||
Returns the sub registry associated with the `subcategory`. If it does not
|
|
||||||
exist yet, the sub registry is created on the fly.
|
|
||||||
|
|
||||||
Reference List
|
Reference List
|
||||||
==============
|
==============
|
||||||
|
Loading…
Reference in New Issue
Block a user