Dependencies

Every JavaScript file in the SCA source contains the same general structure that corresponds to Asynchronous Module Definition (AMD) API. RequireJS uses the AMD API to asynchronously load modules within the application. The following code sample shows the general structure of each file:

          define('<module_name>'
,
   [   '<dependency_1>'
   ,
      '<dependency_2>'.
      ...
   ]

   function (
      <module_1>
   ,   <module_2>
      ...
   )

)
{
      <module code>
} 

        

All files within a module contain one define function which occurs at the beginning of the file and uses the following syntax:

          define(module_id, [dependencies], function) 

        

By following this structure consistently, the developer tools can compile the application into a single JavaScript file by calculating the cascading dependencies starting with the root level application modules down to each lower-level feature and utility modules.

Related Topics

SCA Module Architecture
Application Modules
Feature Modules

General Notices