// Get data from github function httpGetAsync(theUrl, callback) { var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.status == 200) callback(xmlHttp.responseText); } xmlHttp.open("GET", theUrl, true); // true for asynchronous xmlHttp.send(null); } function on_github_response(response) { console.log("read latest events from github!"); var eventList = JSON.parse(response); // console.log(eventList); // Which events to exclude var excludes = ["WatchEvent", "GollumEvent", "IssueCommentEvent", "ForkEvent", "PullRequestReviewCommentEvent"]; // loop over events, filtering out excluded ones const resultList = eventList .filter(item => !(excludes.includes(item.type))) .map(envt => { var output = ""; if (envt.type === "IssueCommentEvent") { output = ( " " + envt.actor.display_login + " commented on issue #" + envt.payload.issue.number + "" ); } else if(envt.type === "IssuesEvent") { output = ( "" + "Issue " + envt.payload.action + ": " + envt.payload.issue.title.slice(0, 20) + ".." + "" ); } else if(envt.type == "PushEvent") { output = ( "" + "Commit by " + envt.payload.commits[0].author.name + ": " + envt.payload.commits[0].message.slice(0, 20) + ".." + "" ); } else if(envt.type == "PullRequestEvent") { output = ( "" + "PR #" + envt.payload.number + " " + envt.payload.action + " by " + envt.actor.display_login + "" ) } return "