What’s the proper way to call a function that’s inside of a controller? Like for example in the below, on initialize say I have some function that has a callback, and then I need to call functions that are also in the controller. (Maybe the approach is wrong?)
(() => {
const application = Stimulus.Application.start();
application.register("mymap", class extends Stimulus.Controller {
customFunction() {}
someOtherFunction() {}
initialize() {
// do stuff when the controller loads
this.customFunction().done(function(img){
// after ajax happens, call some function inside controller
var something = someOtherFunction();
});
}
});
})();