add info about global variables

This commit is contained in:
Leonardo Venturini
2024-05-20 16:00:00 -04:00
parent af39179f53
commit 0ca32390b5
2 changed files with 9 additions and 1 deletions

View File

@@ -32,9 +32,10 @@ export default defineConfig({
{
text: "API Changes",
items: [
{text: "Using Async Functions", link: "/api/async-functions"},
{text: "Global Variables", link: "/api/global-variables"},
{text: "Renamed Functions", link: "/api/renamed-functions"},
{text: "Removed Functions", link: "/api/removed-functions"},
{text: "Using Async Functions", link: "/api/async-functions"},
]
},
{

View File

@@ -0,0 +1,7 @@
# Global Variables
On apps, instead of using `GlobalVar = { ... }` to define a global variable, you should use `global.GlobalVar = { ... }`.
Defining globals in **packages** should still work the same as in Meteor 2.
> For packages, Meteor adds a variable declaration in the package scope, which has the side effect of avoiding this mechanic altogether. In apps, there is no "app scope" so these globals are true globals.