Javascript - Global Library (Namespace pattern)

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript) > Javascript - Library

1 - About

A global library is one that can be accessed from the global scope (i.e. without using any form of import).

namespace pattern is when libraries made themselves available using a single global variable

A global library is also known as a Global module.

Advertising

3 - Example

  • jQuery or $
  • _ for lodash

4 - Implement

GlobalVariablesModule.js
var MyLibrary = function() {};

where the dependency are in the global scope