Skip to content

DanielJDufour/easy-script-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easy-script-loader

Easily Load a Script. Returns a Promise.

load via script tag

<script src="https://unpkg.com/easy-script-loader"></script>

install via npm

npm install easy-script-loader

usage

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>

debugging

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

About

Easily Load a Script. Returns a Promise.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published