如何在模块脚本中声明全局变量

How to declare global variable in module script

我有一个模块脚本,我在其中导入一些 类 并初始化我的应用程序。但是模块 scipts 在模块上下文中声明 var myVar = "my";,这使得主应用程序代码无法访问 init 变量。但是我不知道如何在模块脚本中声明全局变量。

而不是 var myVar = "my"; 使用 window.myVar = "my";