Easily Load a Script. Returns a Promise.
<script src="https://unpkg.com/easy-script-loader"></script>
npm install easy-script-loader
const loadScript = require("easy-script-loader");
or
import loadScript from 'easy-script-loader';
or
<head>
<script src="https://unpkg.com/easy-script-loader"></script>
</head>
<body>
<script>
loadScript("https://unpkg.com/georaster").then(() => {
console.log("loaded georaster!");
});
</script>
</body>
You can pass in an options object with debug
set to true for additional logging.
<head>
<script src="https://unpkg.com/easy-script-loader"></script>
</head>
<body>
<script>
loadScript("https://unpkg.com/georaster", { debug: true });
</script>
</body>
will output
[easy-script-loader] starting to load https://unpkg.com/georaster
[easy-script-loader] successfully loaded https://unpkg.com/georaster