marko-widgets
Version:
Module to support binding of behavior to rendered UI components rendered on the server or client
20 lines (17 loc) • 587 B
JavaScript
var template;
module.exports = require('marko-widgets').defineComponent({
renderer: function(input, out) {
template.render({
name: input.name
},
out);
},
setName: function(name) {
this.getEl('name').innerHTML = name;
}
});
// Loading the template introduces a circular dependency so move it
// below the code that reassigns module.exports. It's a hack
// but it works and is a little better than lazily loading the
// template at render time
template = require('marko').load(require.resolve('./template.marko'));