如何在 VanillaJS 中访问跟踪的变量?

添加 import { on } from “@ember/modifier”; 应该就能解决问题。
查看 Discourse 源代码是个好主意。那里有现成的代码,是学习的好地方。