[DOC] doc: add observer doc

This commit is contained in:
Géry Debongnie
2019-04-25 15:28:20 +02:00
parent 40613e0a76
commit f23a26426d
2 changed files with 57 additions and 1 deletions
+8
View File
@@ -28,6 +28,11 @@ OWL components are the building blocks for user interface. They are designed to
OWL components are defined as a subclass of Component. The rendering is
exclusively done by a [QWeb](qweb.md) template (either defined inline or preloaded in QWeb).
The rendering is done by QWeb, which will generate a virtual dom representation
of the widget, then patch the DOM to apply the changes in an efficient way.
OWL components observe their states, and rerender themselves whenever it is
changed. This is done by an [observer](observer.md).
## Example
@@ -106,6 +111,9 @@ will be used to render the component template.
that this should be very rare to have to do it manually, the Owl framework is
most of the time responsible for doing that at an appropriate moment.
Note that the render method is asynchronous, so one cannot observe the updated
DOM in the same stack frame.
- **`shouldUpdate(nextProps)`**: this method is called each time a component's props
are updated. It returns a boolean, which indicates if the widget should
ignore a props update. If it returns false, then `willUpdateProps` will not