Global Libraries
A global library is one that can be accessed from the global scope (i.e. without using any form of import
). Many libraries simply expose one or more global variables for use. For example, if you were using jQuery, the $
variable can be used by simply referring to it:
$(() => { console.log('hello!'); } );
You’ll usually see guidance in the documentation of a global library of how to use the library in an HTML script tag:
<script src="http://a.great.cdn.for/someLib.js"></script>
Today, most popular globally-accessible libraries are actually written as UMD libraries (see below). UMD library documentation is hard to distinguish from global library documentation. Before writing a global declaration file, make sure the library isn’t actually UMD.
Please login to continue.