JSFiddle - React, Tailwind, and code Playground

by Leo Cavalcante

JavaScript

function News {
}

function GetNewsUseCase(xhr, query) {
    this.xhr = xhr;
    this.xhr.open('GET', 'https://news.google.com.br/news/feeds?q=' + query + '&output=rss');
    this.xhr.oncomplete = this.handleXhrComplete;
}

GetNewsUseCase.prototype.execute = function(request) {
    this.xhr.send();
}

GerNewsUseCase.prototype.handleXhrComplete = function(response) {
    console.log(response);
}

var xhr = new XMLHttpRequest();
var getNewsUseCase = new GetNewsUseCase(xhr, 'dilma');

getNewsUseCase.execute();