Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Globals = function(){
- //set the initial values.
- <cfoutput>#toScript(session.festBuilder,"globals",true,true)#</cfoutput>
- //overwrite the values with the correct data types.
- parseIntToScript(globals);
- //PRIVATE METHODS.
- var setGlobalVal = function (name,val,sync){
- // default server side sync to true.
- if(typeof(sync) === 'undefined'){
- sync = true;
- };
- //update client side object.
- globals[name] = val;
- //synchronize server side object.
- if(sync){
- return saveGlobalValToSession(name,val);
- };
- };
- var getGlobalVal = function (name){
- return globals[name];
- };
- var getGlobalObj = function (){
- return globals;
- };
- var deleteGlobalVal = function(name,sync){
- // default server side sync to true.
- if(typeof(sync) === 'undefined'){
- sync = true;
- };
- delete globals[name];
- //synchronize server side object.
- if(sync){
- deleteGlobalValInSession(name);
- };
- };
- //PUBLIC METHODS.
- return{
- set: function(name,val,sync){
- return setGlobalVal(name.toLowerCase(),val,sync)},
- get: function(name){
- return getGlobalVal(name.toLowerCase())},
- del: function(name,sync){
- return deleteGlobalVal(name.toLowerCase(),sync)},
- getObject : function(){
- return getGlobalObj()}
- }
- }(); //singleton.
Advertisement
Add Comment
Please, Sign In to add comment