tiny-load-script

1.0.0 • Public • Published

tiny-load-script

Load a javascript file and forget about it

Perfect for autonomous libraries like YouTube's and Facebook's APIs.

npm i --save tiny-load-script

The module is simply this:

/**
 * @param  {string} src  The Url to the file to load
 * @return {element}     The <script> element that is being loaded
 */
module.exports = function (src) {
    var s = document.createElement('script');
    s.src = src;
    s.async = true;
    document.head.appendChild(s);
    return s;
};

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i tiny-load-script

      Weekly Downloads

      35

      Version

      1.0.0

      License

      MIT

      Last publish

      Collaborators

      • fregante