From 0ca32390b59cc46ef5d39896fcf322c8b227afb1 Mon Sep 17 00:00:00 2001 From: Leonardo Venturini Date: Mon, 20 May 2024 16:00:00 -0400 Subject: [PATCH] add info about global variables --- v3-docs/v3-migration-docs/.vitepress/config.mts | 3 ++- v3-docs/v3-migration-docs/api/global-variables.md | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 v3-docs/v3-migration-docs/api/global-variables.md diff --git a/v3-docs/v3-migration-docs/.vitepress/config.mts b/v3-docs/v3-migration-docs/.vitepress/config.mts index 18c5a6d75e..f734ef2f18 100644 --- a/v3-docs/v3-migration-docs/.vitepress/config.mts +++ b/v3-docs/v3-migration-docs/.vitepress/config.mts @@ -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"}, ] }, { diff --git a/v3-docs/v3-migration-docs/api/global-variables.md b/v3-docs/v3-migration-docs/api/global-variables.md new file mode 100644 index 0000000000..295ef4bc7e --- /dev/null +++ b/v3-docs/v3-migration-docs/api/global-variables.md @@ -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. \ No newline at end of file