Created
December 18, 2012 20:42
-
-
Save uhtred/4331772 to your computer and use it in GitHub Desktop.
Javascript: Módulo de controle de variáveis globais
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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