JSFiddle - React, Tailwind, and code Playground

by Anchal Nigam

HTML

<a href="#" onclick="return init()">Start (click me)</a>
<div id="one">Div 1<br /><br /></div>
<div id="two">Div 2<br /><br /></div>

CSS

div
{
    border: 1px solid black;
    padding: 5px;
    margin: 5px;
}

#one
{
    background-color: lime;
}

#two
{
    background-color: yellow;
}

JavaScript

var NACHO = function(){
    function model( v )
    {
        this._x = v;
        
        this.updated = new Event( this );
    };
    
    model.prototype = {
        getValue: function(){
            return this._x;
        },
        setValue: function( v ){
            this._x = v;
            this.updated.notify( { value: v } );
        }
    };
    
    function Event( sender )
    {
        this._sender = sender;
        this._listeners = [];
    }
    
    Event.prototype = {
        attach: function( listener ){
            this._listeners
    };
    
    return model;
};