GitHub - commons/common.js: Not a module loader, not a plugin or a framework... Just a collection of common logic for the client.

Not a plugin, not a framework... Just a collection of common JavaScript methods for the client.

The scope of common.js is to persist on the rule "one include of the absolutely necessary" as a foundation to start building any dependency stack.

Features

Includes common polyfills:

Also contains a small toolkit of fundamental operations, mapped in the "c" variable on the global namespace.

Install

Using bower:

Methods

These methods are available in the window.c namespace:

  • query( str ) : Parses a query to a javascript object
  • script( url ) : Adds a new script to the DOM
  • cookie( val ) : Simplified CRUD for document.cookie
  • extend({a}, {b}) : Merging two objects recursively
  • link( url ) : Adds a new link tag, of an HTML import or a stylesheet
  • scroll( options ) : Scroll monitoring for DOM updates - Example
  • type( variable ) : Check the type of a variable
  • visible( element ) : Minimal check if a DOM element is visible in the browser window

Credits

Initialized by Makis Tracend

Part of the Commons collection of web assets

Distributed by Makesites.org

License

Released under the MIT license