minor fixes
This commit is contained in:
parent
3e74537ea4
commit
006343a653
1 changed files with 4 additions and 2 deletions
|
@ -123,9 +123,11 @@ That said, making such global variables is frowned upon. Please try to avoid the
|
|||
|
||||
### A module code is evaluated only the first time when imported
|
||||
|
||||
If the same module is imported into multiple other places, its code is executed only the first time, then exports are given to all importers.
|
||||
If the same module is imported into multiple other modules, its code is executed only once, upon the first import. Then its exports are given to all further importers.
|
||||
|
||||
That has important consequences. Let's look at them using examples:
|
||||
The one-time evaluation has important consequences, that we should be aware of.
|
||||
|
||||
Let's see a couple of examples.
|
||||
|
||||
First, if executing a module code brings side-effects, like showing a message, then importing it multiple times will trigger it only once -- the first time:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue