// amd/use-legacy.js —— 把 shim 包装后的全局构造函数当模块依赖使用 define(['legacy'], function (LegacyCounter) { return { demo: function () { var counter = new LegacyCounter(); counter.inc(); counter.inc(); return counter.n; } }; });