Skip to content

Instantly share code, notes, and snippets.

@joewalker
Created June 26, 2012 14:01
Show Gist options
  • Save joewalker/2995951 to your computer and use it in GitHub Desktop.
Save joewalker/2995951 to your computer and use it in GitHub Desktop.
createView
Basic use of createView
gcli.addCommand({
name: 'foo',
exec: function(args, context) {
return context.createView({
html: '<div>${name}</div>',
data: { name: 'joe' }
});
}
});
createView uses domtemplate: https://github.com/joewalker/domtemplate
So:
gcli.addCommand({
name: 'foo',
exec: function(args, context) {
return context.createView({
html: '<div save="${myroot}"/><div>${activate()}</div>',
options: { allowEval: true },
data: {
activate: function() {
this.myroot.innerHTML = 'hello';
}
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment