JSFiddle - React, Tailwind, and code Playground

by newblt123

HTML

<div id="messages"></div>

JavaScript

$(function(){
    var actions = [];
    registerOmeletteActions(actions);
    makeOmelette(actions);
});

function registerOmeletteActions(actions){
    var crackEggs = {
        deferred: $.Deferred(),
        promise: function(){
            return this.deferred.promise();
        },
        isInProcess: false,
        go: function(){
            msg('cracking eggs');
            this.isInProcess = true;
            console.log(this.deferred);
            this.deferred.resolve();
            return this.deferred.promise();
        },
        stop: function(){
            msg('stop cracking eggs');
            this.isInProcess = false;
            console.log(this.deferred);            
            this.deferred.reject();
            return this.deferred.promise();
        }
    };
       
    var beatEggs = {
        deferred: $.Deferred(),
        promise: function(){
            return this.deferred.promise();
        },
        isInProcess: false,
        go: function(){
            msg('beating eggs');
            this.isInProcess = true;
            console.log(this.deferred);            
            this.deferred.reject();
            return this.deferred.promise();
        },
        stop: function(){
            msg('stop beating eggs');
            this.isInProcess = false;
            console.log(this.deferred);
            this.deferred.resolve();
            return this.deferred.promise();
        }
    };
    
    var washTomatoes = {
        deferred: $.Deferred(),
        promise: function(){
            return this.deferred.promise();
        },
        isInProcess: false,
        go: function(){
            msg('washing tomatoes');
            this.isInProcess = true;
            console.log(this.deferred);
            this.deferred.resolve();
            return this.deferred.promise();
        },
        stop: function(){
            msg('stop washing tomatoes');
            this.isInProcess = false;
            console.log(this.deferred);    ...