Skip to content

Instantly share code, notes, and snippets.

@vinniefranco
Created January 25, 2011 23:16
Show Gist options
  • Save vinniefranco/795908 to your computer and use it in GitHub Desktop.
Save vinniefranco/795908 to your computer and use it in GitHub Desktop.
var Layout = (function() {
/*
TODO Maybe some default modules?
*/
var modules = modules || {};
function addModule(name, callback) {
modules[name] = callback;
}
function applyJSON(json) {
// Loop through the provided json response modules
for(var module in json ) {
if (json.hasOwnProperty(module)) {
// Save the payload
var data = json[module];
// Pass payload to callback
modules[module](data);
}
}
// End xhr.
Dispatcher.setXHR(null);
}
return {
addModule : addModule,
applyJSON: applyJSON
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment