Hi team,
For example, I have a custom element called Abc having a script handler called Xyz:
final class Abc extends Bricks\Element
{
public $scripts = ['Xyz'];
Every time the Abc element being rendered, the Xyz script gets called but Xyz doesn’t know which Abc instance calling it. So, Xyz has to look through the document for all Abc instances and do stuff with all of those Abc instances. I feel this is really inefficient.
Not sure if I’ve been doing it wrong or there’s a technical reason for that.
My suggestion is: can we pass an element instance to the script handler, just like passing the Event object to the event listeners?