Is there a better way to avoid utilizing self = this
because it's conflicting with one of my plugin?
class Test {
constructor() {
self = this;
}
fetchURL(url) {
fetch(url)
.then(function (response) {
self.func1();
});
}
func1() {
console.log("func1");
self.func2();
}
func2() {
console.log("func2");
}
}
document.getElementById("basicFetchButton").addEventListener("click", function () {
let test = new Test();
test.fetchURL('https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js')
// Loading the jQuery code
});
<input type="button" id="basicFetchButton" value="Try it">