mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Initial commit
This commit is contained in:
commit
cb002f4f27
50 changed files with 4666 additions and 0 deletions
25
docs/api/strict-mode.md
Normal file
25
docs/api/strict-mode.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Strict Mode
|
||||
|
||||
Vide has a special mode called "strict mode" which is used for debugging.
|
||||
|
||||
The purpose of strict mode is to help ensure stateful code is *pure*
|
||||
(deterministic and free from side effects) or if there are side-effects, that
|
||||
they are cleaned up correctly.
|
||||
|
||||
Vide is set to strict by doing:
|
||||
|
||||
```lua
|
||||
local vide = require(path_to_vide)
|
||||
vide.strict = true
|
||||
```
|
||||
|
||||
What strict mode will do:
|
||||
|
||||
1. Run derived callbacks twice when re-evaluating.
|
||||
2. Run watcher callbacks twice when a state changes.
|
||||
3. Throw an error if yields occur where they are not allowed.
|
||||
4. Checks for `map()` returning primitive values.
|
||||
5. Better error reporting and stack traces.
|
||||
|
||||
It is recommend to develop UI with strict mode and to disable it when pushing to
|
||||
production.
|
||||
Loading…
Add table
Add a link
Reference in a new issue