Created
January 25, 2011 23:16
-
-
Save vinniefranco/795908 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
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