kony.modules Namespace
The kony.modules namespace enables your apps to load functional modules through synchronous and asynchronous operations on demand. It provides the following API elements.
Functions
The kony.module namespace contains the following functions.
loadFunctionalModule is a synchronous API used to load functional module (views and jsModules) in scope of JavaScript. Until loading of module is complete, further executions will be stopped.
NOTE: If the module is already loaded, then it returns true without reloading the same module.
Syntax
kony.modules.loadFunctionalModule (modulename)
Input Parameters
Parameter | Description |
---|---|
modulename [String] - Mandatory | Unique module name that is defined in the functionalModules.xml file. |
Example
//In module1 you can load module2 as below when required. function buttonClick() { kony.modules.loadFunctionalModule("module2"); //Now we cn access objects defined in module2 frmLogin.show(); }
Return Values
Return Value | Description |
---|---|
Boolean | true: When module is loaded. false: When any issue found while loading. |
Platform Availability
- iOS
- Android
- Desktop Web
The loadFunctionalModuleAsync is an asynchronous API used to load functional module (views and jsModules) in scope of JavaScript. A success callback is invoked after successful completions of load, else error callback will be invoked.
NOTE: If the module is already loaded, then it will call successcallback without loading the same module.
Syntax
kony.modules.loadFunctionalModuleAsync (modulename, successcallback, errorcallback);
Input Parameters
Parameter | Description |
---|---|
modulename [String] - Mandatory | Unique name of the module that is defined in the functionalModules.xml file |
successcallback [Function] - Mandatory |
The callback will be invoked after successful load of module files and after calling corresponding init function, if defined.
|
errorcallback [Function] - Mandatory |
The callback which will be invoked if there are any issue while loading module files.
|
Example
//In module1 you can load module2 as below when required. var successcalback = function (modulename) { //Now we cn access objects defined in module2 frmLogin.show(); } var errorcalback = function (modulename, errorcode) { kony.print("error : " + errorcode + " in module - " + modulename); } function buttonClick() { kony.modules.loadFunctionalModuleAsync("module2", successcalback, errorcalback); }
Error Codes
1250 – Invalid module name is specified.
1251 – Unable to load module.
Platform Availability
- iOS
- Android
- Desktop Web