JSFiddle - React, Tailwind, and code Playground

by Kevin Faulhaber

JavaScript

(function () {
    var myLib = function (o) {
        if (!(this instanceof myLib)) {
            return new myLib(o);
        }
        if (typeof o === 'undefined') {
            o = {};
        }
        this.attribute1 = o.attribute1 || null;
        this.attribute2 = o.attribute2 || null;
    }
    myLib.fn = myLib.prototype = {
        init: function () {}
    }
    myLib.fn.function1 = function () {
        console.log('My first class function: ' + this.attribute1);
    };
    
    window.myLib = myLib;
})()