Jump to content

Guides

Overview of module types

In IPS4, most javascript is split into self-contained, named modules. Modules and javascript files have a one-to-one relationship - each javascript file should contain one module only. Modules prevent variables leaking into the global scope (which must be avoided), and helps ensure code stays focused. All modules appear under the ips namespace.

Types of Module

A number of primary types of module exist within the software:

  • Utility Modules
    Exist on the ips.utils namespace, and provide assorted functionality that other modules can make use of, including cookie handling and methods for handling responsive design.
  • UI widget modules
    Exist on the ips.ui namespace, and define interface widgets to add interactivity to pages, and which can be reused using special data attributes.
  • Controllers
    Controllers are modules that handle specific functionality for one particular page or part of a page. They respond to events from UI widgets and other controllers and update their scope accordingly.
  • Mixins
    Mixins are used to extend controllers with additional functionality.

Other types

There are a number of other types of non-modularized file used too:

  • Libraries/interfaces
    Libraries are 3rd party scripts that provide additional functionality. jQuery and Underscore are two examples.
  • Templates
    Template files define special Mustache templates, that modules can use when rendering HTML to the browser.
  • Languages
    Language files define strings which can be translated into other languages.

  Report Guide


×