Description of module files

The framework uses its own JavaScript file loading system, in which they are modules. JS modules can be loaded both from the server side and from the client side. Each module is declared with the fcf.module() function. And it can be created either by plugins or by the command:

$ fcfmngr create module [MODULE_NAME]

Example module file :templates/blocks/TestModule.js which was generated automatically by the command:

$ cd [PROJECT_DIRECTORY] $ cd templates/blocks $ fcfmngr create module TestModule fcf.module({ name: "templates/blocks/TestModule.js", dependencies: [], lazy: [], module: function(){ var Namespace = fcf.prepareObject(fcf, "root/templates/blocks"); class TestModule { constructor(){ } }; Namespace.TestModule = TestModule; return Namespace.TestModule; } });

Module properties:

string name - The path to the module file in FCF notation which is also its name.

[string] dependencies - An array of module dependencies. These dependencies are loaded first and are available as arguments to the module function (property module), in the sequence specified in the array.

[string] lazy - An array of module dependencies that are loaded after the module is loaded. Access to the data of the modules specified in this parameter is carried out only through global variables. Used in case of cyclic module dependencies.

function module - A module function that should return the data of the module itself. The parameters are the data of the modules specified in the dependencies property.

As you can see from the above example, the auto-generated file already contains the class skeleton and places it in the global fcf object at an address based on the file path.