I have two controllers registered in my Application
a Dropzone element, running as polaris-dropzone controller
application.register("polaris-dropzone", Dropzone);
and a home controller for my homepage, that renders the polaris-dropzone element.
application.register("home", HomeController)
The Dropzone Controller emits an event with this code:
const dropEvent = new CustomEvent("polaris-dropzone:drop", {
detail: {
files: this.files,
acceptedFiles: this.acceptedFiles,
rejectedFiles: this.rejectedFiles
}
});
this.element.dispatchEvent(dropEvent);
I listen for that event in my home controller by wiring up a connection:
<div data-controller="home polaris-dropzone" data-action="polaris-dropzone:drop->home#drop">
I expected my homeController drop method to receive the details from this event that occurred in the Dropzone controller! I never get anything in my homeController drop method when that event does indeed fire off in the Dropzone controller. Silence. Nada.
I seems so easy. But it is not. What am I missing here? What am I doing wrong?