guest271314 (2019-03-10T19:29:50.000Z)
guest271314 at gmail.com (2019-03-10T19:30:49.299Z)
This is probably not the pattern that is being proposed though outputs the expected result class RequestManager { constructor() { this.successMessage = "Xhr successful."; RequestManager.THIS = this; } makeRequest() { var oReq = new XMLHttpRequest(); oReq.addEventListener("load", this.responseHandler); oReq.open("GET", ""); oReq.send(); } responseHandler(e) { console.log(e, this); // `e`: event, `this`: XMLHttpRequest instance console.log(RequestManager.THIS.successMessage); } } var reqManager = new RequestManager(); reqManager.makeRequest();