Skip to content

Instantly share code, notes, and snippets.

@uhtred
Created December 18, 2012 20:42
Show Gist options
  • Save uhtred/4331772 to your computer and use it in GitHub Desktop.
Save uhtred/4331772 to your computer and use it in GitHub Desktop.
Javascript: Módulo de controle de variáveis globais
/**
* Módulo de controle geral do sistema Checkout
*/
var Checkout = (function(){
// Evita conflitos com outros scripts e sistemas
window['bcash_checkout'] = {};
function init(){}
function setGlobalVars( vars ) {
for( var idx in vars ) {
setGlobalVar( idx, vars[idx] );
}
}
function setGlobalVar( name, value ) {
window['bcash_checkout'][ name ] = value;
}
function getGlobalVar( name ) {
if( window['bcash_checkout'][ name ] ) {
return window['bcash_checkout'][ name ];
}
}
return {
init: init,
setGlobalVars: setGlobalVars,
setGlobalVar: setGlobalVar,
getGlobalVar: getGlobalVar
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment