UNPKG

marko-widgets

Version:

Module to support binding of behavior to rendered UI components rendered on the server or client

18 lines (17 loc) 456 B
module.exports = require('marko-widgets').defineComponent({ template: require.resolve('./template.marko'), getInitialState: function(input) { return { colors: input.colors || [] }; }, getTemplateData: function(state, input) { return { colors: state.colors }; }, addColor: function(color) { this.state.colors.push(color); this.setStateDirty('color'); } });