Skip to content

Instantly share code, notes, and snippets.

@kembuco
Created December 19, 2011 03:46
Show Gist options
  • Save kembuco/1495290 to your computer and use it in GitHub Desktop.
Save kembuco/1495290 to your computer and use it in GitHub Desktop.
Dust Loader
var result;
(function() {
load(basePath + "/dust/dust-full-0.3.0.js");
var entries = modelMap.entrySet().iterator(),
model = {},
entry;
// Convert model from java Map to javascript Object
while(entries.hasNext()) {
entry = entries.next();
model[entry.getKey()] = entry.getValue();
}
var compiled = dust.compile(template, "template");
dust.loadSource(compiled);
dust.render("template", model, function(err, out) {
result = out;
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment