Javascript - Library

About

library in Javascript.

A library is a distribution format as a package that is created

The difference between a package and a library is that the modules are compiled into one file called a library that is accessible via a single global variable without any sort of import.

Example

jQuery:

  • The installation of the Jquery library
<script
  src="https://code.jquery.com/jquery-3.4.1.slim.js"
  integrity="sha256-BTlTdQO9/fascB1drekrDVkaKd9PkwBymMlHOiG+qLI="
  crossorigin="anonymous"></script>
  • jQuery is accessible via the jQuery variable. We select the body element and add a h2 header.
jQuery('body').after("<h2>Hello Foo</h2>");

Management

Creation

Installation

A library is installed via the script element of the html page. The library will be then available via a global variable

As a library is another format distribution of a package. If you are working in a project developed locally with the node engine, you may also want to install it as a package via a package manager)

List

Every package may takes the form of a library

Example:

  • AngularJs
  • Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.
  • The Dojo Toolkit is a modular open source JavaScript toolkit (or library), designed to ease the rapid development of cross platform, JavaScript/Ajax based applications and web sites
  • closure-library - Google javascript library - The Closure Library contains many different tools, from user interface widgets to communication utilities. Closure makes Javascript more like Java. (big learning curve) Closure's strength is building complicated, heavy Javascript webapps. The annotated type system, the compilation, the OOP-focus have all been designed to make JS look like Java.

Popularity

http://libscore.com/ example: http://libscore.com/#libs

Documentation / Reference

Task Runner