示例工程 17-pre-module-globals
17-pre-module-globals/01-global-collision/src/main.ts
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
// 模块脚本读取最终生效的全局 config
export function run(log: (msg: string) => void = console.log): string[] {
const lines = [config.theme, String(config.debug ?? false)];
for (const line of lines) {
log(line);
}
return lines;
}