JSFiddle - React, Tailwind, and code Playground

by amindunited

JavaScript

(function(){
    var _b_d = function(){
        return this;
    }
    //initial prototyping
    _b_d.prototype = {
        name : "boxes!",
        add: function(obj){
            this.objects.push(obj)
            return this;
        },
        objects : []
    }
    window.box_diagrammer = function(){
        return new _b_d();
    }
})();

var bd = box_diagrammer();
bd.add({'name':'first object'});
console.log(bd.objects);
console.log(bd);