语言核心
异步与运行时
模块演化史
构建与工具链
浏览器与工程
10-amd-requirejs
10-amd-requirejs/02-paths-shim/legacy.js
javascript · 0.2 KB
运行:10 · paths 与 shim
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
console
// legacy.js —— 非 AMD 的老库:只往全局挂一个构造函数 window.LegacyCounter = function LegacyCounter() { this.n = 0; }; window.LegacyCounter.prototype.inc = function () { this.n += 1; return this.n; };
该文件由构建期采集,未做任何改写;源码页不进入搜索引擎索引。