How to use the marko/widgets/legacy.defineComponent function in marko

To help you get started, we’ve selected a few marko 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 marko-js / marko / test / autotests / widgets-browser-deprecated / widget-rerender-init-order / components / app-rerender-init-order-child / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
    template: require('./template.marko'),
    getInitialState: function(input) {
        return {
            version: input.version,
            id: input.id
        };
    },
    getTemplateData: function(state, input) {
        return {
            version: state.version,
            id: state.id
        };
    },
    init: function() {
        // console.log(module.id, 'init()', this.state);
        window.rerenderInitOrder.push(this.state.id);
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-subscribeTo / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
    template: require('./template.marko'),
    
    init: function() {

    }
});
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-replaceState / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
    template: require.resolve('./template.marko'),
    getInitialState: function(input) {
        return {
            heading: input.heading || '',
            message: input.message || '',
            colors: input.colors || []
        };
    },
    getTemplateData: function(state, input) {
        return {
            heading: state.heading,
            message: state.message,
            colors: state.colors
        };
    }
});
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-lifecycle-events-stateless / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
	template: require.resolve('./template.marko'),

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

	init: function() {
        this.lifecycleEvents = [];

		this.recordWidgetLifecycleEvent('init');
	},

	onRender: function(eventArg) {
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-stateful-update-handler / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
    template: require.resolve('./template.marko'),
    getInitialState: function(input) {
        return {
            buttonSize: 'small',
            buttonLabel: 'Initial Label'
        };
    },
    getTemplateData: function(state, input) {
        return {
            buttonSize: state.buttonSize,
            buttonLabel: state.buttonLabel
        };
    },

    update_buttonSize: function(newSize) {
        var button1Widget = this.getWidget('button1');
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-repeated-id-widgetless / index.js View on Github external
var widgetLessRenderer = require('./components/app-widgetless/renderer');
var simpleRenderer = require('./components/app-simple').renderer;

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

	getTemplateData: function(state, input) {
		return {
			renderers: [
                widgetLessRenderer,
                widgetLessRenderer,
                simpleRenderer
            ]
		};
	}
});
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-split-into-multiple-templates / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
    template: require('./template.marko'),
    
    init: function() {

    }
});
github marko-js / marko / test / autotests / widgets-server / getRenderedWidgets / components / app-simple / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
	template: require.resolve('./template.marko'),

	getWidgetConfig: function() {
		return {
			type: 'widget config'
		};
	},

	getInitialState: function() {
		return {
			type: 'widget state'
		};
	},

	getTemplateData: function(state, input) {
		return {
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-stateful-update-handler-no-match / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
    template: require.resolve('./template.marko'),
    getInitialState: function(input) {
        return {
            buttonSize: 'small',
            buttonLabel: 'Initial Label'
        };
    },
    getTemplateData: function(state, input) {
        return {
            buttonSize: state.buttonSize,
            buttonLabel: state.buttonLabel
        };
    },

    update_buttonSize: function(newSize) {
        var button1Widget = this.getWidget('button1');
github marko-js / marko / test / autotests / widgets-browser-deprecated / widget-stateful-reuse-widgets / index.js View on Github external
module.exports = require('marko/widgets/legacy').defineComponent({
    template: require('./template.marko'),
    getInitialState: function(input) {
        return {
            buttonSize: input.buttonSize || 'normal'
        };
    },
    getTemplateData: function(state, input) {
        return {
            buttonSize: state.buttonSize
        };
    },

    setButtonSize: function(size) {
        this.setState('buttonSize', size);
    },
    init: function() {