class Test{
constructor() {
this.VideoUrl = "";
this.url = "https"
}
getUrl(){
let xhr = new XMLHttpRequest();
xhr.open("GET", this.url, true);
xhr.send();
let transfer =(x)=>{
this.urlToVideo = x;
}
function handler() {
let VideoUrl = this.responseXML
transfer(VideoUrl);
}
xhr.onload = handler;
}
get log(){
this.getUrl()
console.log(this.urlToVideo)
}
}
let transfer =(x)=>{
this.urlToVideo = x;
this.log = ()=>{
console.log(this.urlToVideo )
}
}
function handler() {
let VideoUrl = this.responseXML
transfer(VideoUrl);
}
или так ?