Created
February 4, 2009 20:06
-
-
Save tivac/58309 to your computer and use it in GitHub Desktop.
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
YUI.add('config', function(Y) { | |
Y.Config = function() { | |
var conf; | |
function _parse() { | |
try { | |
conf = Y.JSON.parse("{ \"foo\" : 1, \"foo2\" : 2 }"); | |
} catch(e) { | |
console.log("Error Parsing"); | |
} | |
console.log("Y.Config :: _parse: %o", conf); | |
} | |
function _read(key) { | |
if(key) { | |
return conf[key] || false; | |
} else { | |
return conf; | |
} | |
} | |
function _write(key, value) { | |
conf[key] = value; | |
} | |
_parse(); | |
return { | |
parse : _parse, | |
read : _read, | |
write : _write | |
} | |
}(); | |
}, '.01', { requires : ['json-parse'] }); | |
YUI.Test = YUI(); | |
YUI.Test.use('config', function(Y) { | |
console.log("Block 1 :: Y.Config: %o", Y.Config); | |
}); | |
YUI.Test.use('config', function(Y) { | |
console.log("Block 2 :: Y.Config: %o", Y.Config); | |
}); | |
YUI.Test.use('config', function(Y) { | |
console.log("Block 3 :: Y.Config: %o", Y.Config); | |
}); | |
YUI.Test.use('config', function(Y) { | |
console.log("Block 4 :: Y.Config: %o", Y.Config); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment