JSFiddle - React, Tailwind, and code Playground

by dsbonev

JavaScript

YUI().use('event', function publishEvent(Y) {
    var eat = function () {
        console.log('eating...');
    };
    
    Y.publish('timeForBreakfast', {
        emitFacade: true,
        broadcast: 2,
        defaultFn: eat,
        fireOnce: true
    });
        
    var getUp = function () {
        console.log('get up from bed');
    };
    
    Y.on('timeForBreakfast', getUp);
    
    Y.fire('timeForBreakfast');
});