JSFiddle - React, Tailwind, and code Playground

by ericf

JavaScript

YUI().use('base', function(Y){

    var Foo = Y.Base.create('foo', Y.Base, [], {
    
        initializer : function () {
            this._requireAttrs([ 'title', 'body' ]);
        },
        
        _requireAttrs : function (attrs) {
            Y.each(attrs, Y.bind(function(attr){
                if ( ! Y.Lang.isValue(this.get(attr))) {
                    Y.error('A ' + this.name + ' needs to be constructed with: ' + attr);
                }
            }, this));
        }
    
    }, {
    
        ATTRS : {
            title : {},
            body : {}
        }
        
    });
    
    var foo = new Foo();

});