The kony.modules namespace enables your apps to load functional modules through synchronous and asynchronous operations on demand. It provides the following API elements.
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
Available on iOS, Android, Windows, SPA and 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
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
Available on iOS, Android, Windows, SPA and Desktop Web.

| Copyright © 2013 Kony, Inc. All rights reserved. |