假设我有一个这样的UMD模块(保存在'js/mymodule.js'中):
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.mymodule = global.mymodule || {})));
}(this, function (exports) { 'use strict';
function myFunction() {
console.log('hello world');
}
}));
Run Code Online (Sandbox Code Playgroud)
如何在这样的HTML文件中使用此模块?(没有requirejs,commonjs,systemjs等......)
<!doctype html>
<html>
<head>
<title>Using MyModule</title>
<script src="js/mymodule.js"></script>
</head>
<body>
<script>
/* HOW TO USE myFunction from mymodule.js ??? */
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
非常感谢您的帮助.