Created
June 26, 2012 14:01
-
-
Save joewalker/2995951 to your computer and use it in GitHub Desktop.
createView
This file contains hidden or 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
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