Common patterns?

Here is a bit of code that was given to me by @nowhereman.

getControllerByIdentifier(identifier) {
  return this.application.controllers.find(controller => {
    return controller.context.identifier === identifier;
  });
}

It works well but only for a child controller to find its parent controller. It also assumes that there is only one parent controller on the same page.

I agree that those helper functions can be placed in a common ApplicationController and extend all your controllers from this supercharged controller.

I might be wrong but I was under the impression that the recent refactoring in the 1.1 tag where a step toward better support for communicating between controllers https://github.com/stimulusjs/stimulus/milestone/2?closed=1.