JSFiddle - React, Tailwind, and code Playground

by Valentin Radulescu

HTML

<h1><a href="http://css-tricks.com/how-do-you-structure-javascript-the-module-pattern-edition/">How Do You Structure JavaScript? The Module Pattern Edition</a></h1>

<button id="article-list">Article List</button>
<button id="more-button">More Articles</button>

JavaScript

var s, NewsWidget = {
    settings: {
        numArticles: 5,
        articleList: $("#article-list"),
        moreButton: $("#more-button")
    },
    
    init: function(){
        s = this.settings;
    },
    
    bindUIActions: function(){
        s.moreButton.on('click', function(){
            NewsWidget.getMoreArticles(s.numArticles);
        });
    },
    
    getMoreArticles: function(num){
        console.log('get '+num+' articles');
    }
};
var dick = 0;

(function(){
    NewsWidget.init();
})();