Angenommen, ich habe ein UMD-Modul wie folgt verwenden (gespeichert in 'js/mymodule.js'):Wie UMD in Browser ohne zusätzliche Abhängigkeiten
(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');
}
}));
Wie kann ich dieses Modul in ein verwenden HTML-Datei so? (Ohne requirejs, Commonjs, systemjs, etc ...)
<!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>
Vielen Dank im Voraus für jede Hilfe.
Ich fürchte, Sie vermischen UMD mit AMD. –