Servoy Version 6.0.6
I believe there is something fundementally wrong with the 'mod_datejs' initialization code logic and would like a second opinion before posting this on Servoy Forge.
Note that the first line of the initialization method 'mod_datejs_init()' calls another method called 'globals.mod_datejs_isEnvExtended()':
- Code: Select all
if ( globals.mod_datejs_isEnvExtended() ) return false;
Also, note that the first line of the 'mod_datejs_init()' method tests for the existence of the global variable 'ModDateJs':
- Code: Select all
if ( typeof ModDateJs == 'undefined' ) return false;
Since 'ModDateJs' is defined globally, the test:
- Code: Select all
typeof ModDateJs == 'undefined'
returns 'false' causing the 'if' statement to fall through, thus 'function mod_datejs_isEnvExtended()' returns 'true'.
This return value of true causes the 'if' statement in the initialization code to return 'false', thus the second line of code:
- Code: Select all
globals.mod_datejs_load();
never gets executed, and the 'mod_datejs' methods cannot be found by the calling methods. This was the case in our solution.
We found that commenting out the first line of code in the initialization method causes the 'mod_datejs' methods to load and work.
Full code:
- Code: Select all
/**
* @type {String}
*
* @properties={typeid:35,uuid:"85220A71-4B03-4E5E-8F7C-99D1273B8642",variableType:12}
*/
var ModDateJs = null;
/**
* @properties={typeid:24,uuid:"f333f53c-70c7-4f0f-943b-56c0e2078539"}
*/
function mod_datejs_init()
{
if ( globals.mod_datejs_isEnvExtended() ) return false;
globals.mod_datejs_load();
ModDateJs = { version: globals.mod_datejs_version() };
return true;
}
/**
* @properties={typeid:24,uuid:"0bc4ddca-19aa-4573-b7e1-138ba13047f7"}
*/
function mod_datejs_isEnvExtended()
{
if ( typeof ModDateJs == 'undefined' ) return false;
return true;
}