Skip to content

Instantly share code, notes, and snippets.

@tivac
Created February 4, 2009 20:06
Show Gist options
  • Save tivac/58309 to your computer and use it in GitHub Desktop.
Save tivac/58309 to your computer and use it in GitHub Desktop.
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