[IMP] doc: document dev mode

This commit is contained in:
Samuel Degueldre
2022-03-08 11:02:22 +01:00
committed by Géry Debongnie
parent c356351de2
commit 4770b91faa
2 changed files with 16 additions and 4 deletions
+1
View File
@@ -82,6 +82,7 @@ Are you new to Owl? This is the place to start!
- [Component](doc/reference/component.md) - [Component](doc/reference/component.md)
- [Component Lifecycle](doc/reference/component.md#lifecycle) - [Component Lifecycle](doc/reference/component.md#lifecycle)
- [Concurrency Model](doc/reference/concurrency_model.md) - [Concurrency Model](doc/reference/concurrency_model.md)
- [Dev mode](doc/reference/app.md#dev-mode)
- [Dynamic sub components](doc/reference/component.md#dynamic-sub-components) - [Dynamic sub components](doc/reference/component.md#dynamic-sub-components)
- [Environment](doc/reference/environment.md) - [Environment](doc/reference/environment.md)
- [Error Handling](doc/reference/error_handling.md) - [Error Handling](doc/reference/error_handling.md)
+15 -4
View File
@@ -51,11 +51,10 @@ The `config` object is an object with some of the following keys:
- **`env (object)`**: if given, this will be the shared `env` given to each component - **`env (object)`**: if given, this will be the shared `env` given to each component
- **`props (object)`**: the props given to the root component - **`props (object)`**: the props given to the root component
- **`dev (boolean, default=false)`**: if `true`, the application is rendered in `dev` - **`dev (boolean, default=false)`**: if `true`, the application is rendered in
mode, which activates some additional checks (in particular, the props validation [`dev` mode](#dev-mode);
code is only performed in dev mode)
- **`test (boolean, default=false)`**: `test` mode is the same as `dev` mode, except - **`test (boolean, default=false)`**: `test` mode is the same as `dev` mode, except
that Owll will not log a message to warn that Owl is in `dev` mode. that Owl will not log a message to warn that Owl is in `dev` mode.
- **`translatableAttributes (string[])`**: a list of additional attributes that should - **`translatableAttributes (string[])`**: a list of additional attributes that should
be translated (see [translations](translations.md)) be translated (see [translations](translations.md))
- **`translateFn (function)`**: a function that will be called by owl to translate - **`translateFn (function)`**: a function that will be called by owl to translate
@@ -110,3 +109,15 @@ const { loadFile, mount } = owl;
mount(Root, document.body, { env }); mount(Root, document.body, { env });
})(); })();
``` ```
## Dev mode
Dev mode activates some additional checks and developer amenities:
- [Props validation](./props.md#props-validation) is performed
- [t-foreach](./templates.md#loops) loops check for key unicity
- Lifecycle hooks are wrapped to report their errors in a more developer-friendly way
- Component nodes (the `__owl__` property on components) have an additional "subscriptions"
property, containing a list of objects that the component is observing through the reactivity
system, as well as which keys are observed for each object, which can be useful for
debugging extraneous or missing renders