if( typeof define === "function" && define.amd ){
define(factory);
}
else if( typeof module != "undefined" && typeof module.exports != "undefined" ){
module.exports = factory();
}
else {
window["Sortable"] = factory();
}
是什么意思?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
if(typeof define === "function" && define.amd) {
} else if (typeof module != "undefined" && typeof module.exports != "undefined") {
} else {
}
这是一段典型的umd格式代码。
目标很简单,就是希望这个库能够成功的运行在
AMD,CommonJS以及普通的<script>标签加载的环境里。这应该是那个js函数中的代码片段,其中已经声明了
define,module,factory变量