Hi, I have implemented a controller which instantiates drag and drop functionality using the Sortable library, and I want to know how I can keep the controller generic whilst defining what should happen in the onEnd event for a specific use case.
Here is the code:
import { Controller } from "stimulus";
import Sortable from "sortablejs";
export default class extends Controller {
connect() {
this.sortable = Sortable.create(this.element, {
onEnd: this.onEnd
})
}
onEnd() {
// This code will depend on the context, how should it be arranged?
}
}
Thanks