{"size": 1004, "ext": "js", "max_stars_repo_path": "public/javascripts/communicationModule.js", "max_stars_repo_name": "ChristosMonogios/Word-Cloud", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/javascripts/communicationModule.js", "max_issues_repo_name": "ChristosMonogios/Word-Cloud", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/javascripts/communicationModule.js", "max_forks_repo_name": "ChristosMonogios/Word-Cloud", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.6857142857, "max_line_length": 111, "alphanum_fraction": 0.4611553785}
// The "contains all" object
var wordCloud = {};

wordCloud.communicationModule = (function() {
    var xmlHttp = new XMLHttpRequest();
    
    function get(onSuccess, onError) {
        xmlHttp.onreadystatechange = function() {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    if (onSuccess instanceof Function) {
                        onSuccess(JSON.parse(xmlHttp.responseText));                                           
                    } else {
                        console.log("do nothing with the results.");
                    }
                } else {
                    onError();
                }
            }
           
        };
        xmlHttp.open("GET", "/topics", true);
        xmlHttp.send();
    }
    
    function defaultOnErrorAction() {
        alert("An error happend while loading the results.");
    }
    
    return {
        get: get,
        defaultOnErrorAction: defaultOnErrorAction
    }
})();
