Oracle JET and RequireJS

RequireJS is a JavaScript file and module loader that simplifies managing library references and is designed to improve the speed and quality of your code.

RequireJS implements the Asynchronous Module Definition (AMD) API which provides a mechanism for asynchronously loading a module and its dependencies.

Oracle JET's modular organization enables application developers to load a subset of needed features without having to execute require() calls for each referenced object. Each Oracle JET module represents one functional area of the framework, and it typically defines more than one JavaScript object. The ojs/ojcore module defines the oj namespace object, and all subsequently loaded modules place their exported objects within the oj namespace.

Note:

Oracle JET reserves the oj namespace, and you may not use oj as a namespace in your Oracle JET application.

You do not have to use RequireJS to reference Oracle JET libraries, but it is required if you plan to use Oracle JET's internationalization or data visualization components in your application. The Oracle JET download includes the RequireJS library, and it is used by default in the Oracle JET Starter Templates and Cookbook examples.

For more information about RequireJS, see http://requirejs.org.

Oracle JET Module Organization

The Oracle JET modules are listed in the following table with description and usage tips. Use this table to determine which modules you must load in your application.

Oracle JET Module Description When to Use?

ojs/ojcore

Core framework module that defines a base Oracle JET object. Includes support for prototype-based JavaScript object inheritance and extending JavaScript objects by copying their properties. The module returns oj namespace. You must include this module in any Oracle JET application.

Always

ojs/ojmodel

Oracle JET's Common Model

Use if your application uses the Oracle JET Common Model.

ojs/ojknockout-model

Utilities for integrating Oracle JET's Common Model into Knockout.js

Use if your application uses the Oracle JET Common Model, and you want to integrate with Knockout.js.

ojs/ojknockout-validation

Support for the invalidComponentTracker binding option on input components

Use if your application uses validators or converters, and you want to track the validity of the Oracle JET components in your application.

ojs/ojcomponent:

Oracle JET component modules. Examples include
  • ojs/ojbutton

  • ojs/ojtoolbar

  • ojs/ojtabs

Most Oracle JET components have their own module with the same name in lowercase as shown above, except for the following components:
  • ojButtonset: ojs/ojbutton

  • ojInputPassword: ojs/ojinputtext

  • ojTextArea: ojs/ojinputtext

  • ojCombobox: ojs/ojselectcombobox

  • ojSelect: ojs/ojselectcombobox

  • ojSparkChart: ojs/ojchart

  • ojDialGauge: ojs/ojgauge

  • ojLedGauge: ojs/ojgauge

  • ojRatingGauge: ojs/ojgauge

  • ojStatusMeterGauge: ojs/ojgauge

Use component modules that correspond to any Oracle JET component in your application.

ojs/ojknockout

Oracle JET ojComponent binding and services for Knockout.js

Use if your application includes Oracle JET components and you want to use ojComponent binding for these components in Knockout.js.

ojs/ojrouter

Class for managing routing in single page applications

Use if your single page application uses oj.Router for routing.

ojs/ojmodule

Binding for Knockout.js that implements navigation within a region of a single page application

Use if your single page application uses the ojModule binding for managing content replacement within a page region.

ojs/ojmoduleanimations

Used in conjunction with ojs/ojmodule. Adds animation support via CSS animation effects.

Use if your application adds animation effects.

ojs/ojoffcanvas

Methods for controlling off-canvas regions

Use if your application uses oj.offCanvasUtils for managing off-canvas regions.

ojs/ojcube

Class for aggregating data values in ojDataGrid

Use if your application renders aggregated cubic data in an ojDataGrid component.

ojs/ojtypedatasource

Data source modules. Examples include:
  • ojs/ojarraydatagriddatasource

  • ojs/ojcollectionpagingdatasource

  • ojs/ojjsontreedatasource

Use if your application includes an Oracle JET component, and its data source is defined in one of the oj.*DataSource classes.

basemaps/ojthematicmap-basemap-layer

Built-in basemap to be loaded for an ojThematicMap via RequireJS. Examples include:
  • basemaps/ojthematicmap-world-continents

  • basemaps/ojthematicmap-africa-countries

  • basemaps/ojthematicmap-usa-states

Use if your application shows data with geographic locations and has several built-in maps.

ojs/ojtimezonedata

Time zone data

Use if you want to add time zone support to ojInputDateTime, ojInputTime, or converters.

ojs/ojvalidaton-datetime

Date and time validation and conversion services. Includes ojs/ojvalidation-base.

Use if your application does not have ojInputDateTime but uses a date and time converter or validator.

ojs/ojvalidation-number

Number validation and conversion services. Includes ojs/ojvalidation-base.

Use if your application does not have ojInputNumber but uses a number converter or validator.

ojs/ojvalidation-base

Some of the base classes for converters and validators. Smaller data validation and conversion services compared to ojs/ojvalidation-datetime or ojs/ojvalidation-number (for example, oj.RequiredValidator, oj.LengthValidator, oj.RegExpValidator).

Use if your application uses converters or validators that are not date, time or number outside of Oracle JET editable components.

Note:

Oracle JET includes several modules that aren't listed in this table because they are dependencies of other modules. When you load an Oracle JET component module, the module's dependencies are also loaded by default, and you do not need to include them explicitly. For example, ojTabs requires the ojs/ojcomponentcore module, and the ojs/ojcomponentcore module will load automatically when you specify the ojs/ojtabs module in your RequireJS bootstrap file.