PDA

View Full Version : [OPEN] [OPEN-EXTJSIV-294] multiple 'var' from set and get functions in Ext.util.Cookies



dolittle
23 Mar 2011, 3:35 PM
It is possible to remove several 'var' decelerations to shorten the functions.
Example:


set : function(name, value){
var argv = arguments,
argc = arguments.length,
expires = (argc > 2) ? argv[2] : null,
path = (argc > 3) ? argv[3] : '/',
domain = (argc > 4) ? argv[4] : null,
secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape(value) + ((expires === null) ? "" : ("; expires=" + expires.toGMTString())) + ((path === null) ? "" : ("; path=" + path)) + ((domain === null) ? "" : ("; domain=" + domain)) + ((secure === true) ? "; secure" : "");
},