How to use the marko-widgets.defineComponent function in marko-widgets

To help you get started, we’ve selected a few marko-widgets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / examples / marko-cli / src / components / marko-widgets / button / index.js View on Github external
htmlAttributes: input,
  };
}

function handleClick() {
  if (!this.state.disabled) {
    // eslint-disable-next-line no-undef,no-alert
    alert('button-click');
  }
}

function getInitialBody(input) {
  return input.body;
}

module.exports = markoWidgets.defineComponent({
  template,
  getInitialState,
  getTemplateData,
  getInitialBody,
  handleClick,
});
github marko-js / marko / test / autotests / components-pages-deprecated / custom-events / components / app-fancy-button / index.js View on Github external
module.exports = require('marko-widgets').defineComponent({
    template: require.resolve('./template.marko'),

    getTemplateData: function(state, input) {
        return {
            label: input.label
        };
    },

    emitPressEvent: function() {
        this.emit('press', { widget: this });
    }
});
github marko-js / marko / test / autotests / components-pages-deprecated / widget-config / components / app-foo / index.js View on Github external
module.exports = require('marko-widgets').defineComponent({
    template: require('./template.marko'),

    getWidgetConfig: function() {
        return {
            name: 'app-foo'
        };
    },

    init: function(widgetConfig) {
        this.widgetConfig = widgetConfig;
        window.fooWidget = this;
    }
});
github marko-js / marko / test / autotests-browser / widget-invoke-widget-id-dynamic / index.js View on Github external
var barRenderer = require('./components/app-bar/renderer').render;

module.exports = require('marko-widgets').defineComponent({
    template: require('./template.marko'),
    getTemplateData: function(input, out) {
        return {
            barRenderer: barRenderer,
            barWidgetId: 'myBar'
        };
    }
});
github marko-js / marko / test / autotests / components-pages-deprecated / init-widgets-tag / components / app-baz / index.js View on Github external
module.exports = require('marko-widgets').defineComponent({
    template: require('./template.marko'),

    init: function() {
        window.bazWidget = this;
    }
});
github marko-js / marko / test / autotests / components-pages-deprecated / init-widgets-immediate-await-client-reorder / components / app-foo / index.js View on Github external
module.exports = require('marko-widgets').defineComponent({
    template: require('./template.marko'),

    init: function() {
        window.fooWidget = this;
    }
});
github marko-js-samples / ui-components-playground-lasso-express / src / components / app-tabs / index.js View on Github external
require('./style.less');

module.exports = require('marko-widgets').defineComponent({
    template: require('./template.marko'),

    getInitialProps: function(input) {
        var tabs = [];
        var activeIndex = -1;


        function addTab(tab) {
            if (tab.active) {
                activeIndex = tabs.length;
            }

            tabs.push(tab);
        }

        if (input.tabs) {
github marko-js-samples / ui-components-playground-lasso-express / src / components / app-checkbox / index.js View on Github external
require('./style.less');

module.exports = require('marko-widgets').defineComponent({
    template: require('./template.marko'),
    getInitialState: function(input) {
        return {
            checked: input.checked === true,
            checkboxClassName: input['class'] || input.checkboxClassName,
            data: input.data
        };
    },
    getTemplateData: function(state, input) {
        var checked = state.checked;
        var className = 'app-checkbox';

        if (state.checkboxClassName) {
            className += ' ' + state.checkboxClassName;
        }

marko-widgets

<h1 align="center"> <!-- Logo --> <br/> marko-widgets@8 <br/>

MIT
Latest version published 10 days ago

Package Health Score

71 / 100
Full package analysis

Similar packages