First I define a base JS class which will be included in any page to define a package (or you can call it 'namespace'). See right figure for detail source code.
Second, I will call this method in any JS class - define the package just like java class.
/**Third, I can call following public functions from any JS class.
* Copyright(c) 2006-2007 ...
*/
package("FEYA.util");
/**
* This JS is used to define a bunch of util class
*
* @author fzhuang
* @Date July 26, 2007
*/
FEYA.util.common = function(){
// private variable/function. Not accessible from outside
var count = 0;
var increaseCount = function(){count++;};
// Priviledged method. Can be called from outside
return {
formatDate: function(value){
return value ? value.dateFormat('D, M d Y') : '';
}
}
}();
FEYA.util.common.formatDate
No comments:
Post a Comment