I instantiate this class in a different file by saying RunConfigurationController controller = new RunConfigurationController()
.
In the constructor, I make a new RunConfigurationView and then set the onclick functionality. Then when I run the program, and execute the cancel button click, I get an error saying that I cannot access Uncaught TypeError: Cannot read property 'getRunConfigurationModal' of undefined
.
How can I access the "this" variable which I created in the constructor from another method inside the same class.
'use babel';
import RunConfigurationView from './run-configuration-view'
export default class RunConfigurationController {
constructor() {
this.runConfigurationView = new RunConfigurationView();
this.runConfigurationView.getUpdateButton().onclick = this.updateButtonClick;
this.runConfigurationView.getCancelButton().onclick = this.cancelButtonClick;
}
updateButtonClick() {
}
cancelButtonClick() {
this.runConfigurationView.getRunConfigurationModal().remove();
}
getRunConfigurationView() {
return this.runConfigurationView;
}
}