JSFiddle - React, Tailwind, and code Playground

by Osoascam

JavaScript

$(document).ready(function() {

    (function($, window, NGI) {

        // Module Definition
        NGI.Pages.PAGENAME = (function() {

            // Begin Module Private Section
            var privateVariable = "This is a private variable only visible inside this module";

            function privateFunction(param) {
                return "this is a private function only visible inside this module";
            }

            function getAppCatalog(template) {
                NGI.ServiceInterface.callService({
                    "moduleId": "testAppCatalog",
                    "functionId": "getAppCatalog",
                    "params": {
                        "categories": "General"
                    },
                    "callback": {
                        "0": succesGetAppCatalog(data, template),
                        "7": errorInvalidUser(data, template),
                        "300": errorAppNotAvailable(data, template)
                    }
                });
            }

            function succesGetAppCatalog(data, template) {
                $(template).render(data);
            }

            function errorInvalidUser(data) {
                alert("You LIAR!");
            }
            
            function errorAppNotAvailable(data) {
                alert("You are SOOO screwed);
            }

            // Begin Module Public Section
            return {

                init: function() {

                    privateFunction(otherParam);

                }()


            };

        })();

    })(jQuery, window, NGI);

});