    Request = function(body,timeOut, callbackFillResponse, serverUrl, method){
      this.method = method || 'GET';
      this.body = body;
      this.timeOut = timeOut;
      this.callbackFillResponse = callbackFillResponse;
      this.serverUrl = serverUrl ? serverUrl :  (window.location.protocol + '//' + window.location.hostname + ':' + window.location.port);

      this.requestIsBusy = false;
      this.timerQuery = null;
      this.start = () => {
        this.timerQuery = setInterval(this.requestExec, this.timeOut, this.body);    
      }
      this.stop = () => {
        if (this.timerQuery){
          clearInterval(this.timerQuery)
          this.timerQuery = null;
        }
      }
      this.currRequestExec = () => {
        return this.requestExec(this.body);
      }
      this.requestExec = (body) => {
        if (this.requestIsBusy) {
          return;
        }
        this.requestIsBusy = true;

        let url = this.serverUrl;// "http://127.0.0.1:7766";
        aSyncRequest(url, body, this.method).then(
            (data) => {
                this.requestIsBusy = false;
                this.callbackFillResponse(data);
            })
            .catch((e) => {
//                alert(e.message)
              this.requestIsBusy = false;
              console.log(e.message);
            });
      }

    }

function createRequestInstance(body,timeOut, callbackFillResponse, autoStart, serverUrl){
    let request = new Request(body,timeOut, callbackFillResponse, serverUrl);
    if (autoStart){
      request.currRequestExec();
      request.start();
    }
    return request;
}