And then the package adds the appropriate helpers, it sets something to be done when the template is rendered, and then some cleanup when the template is destroyed.
Is there a way to do this?
As I understand it, right now I can only add the appropriate helpers so the user has to add the rest of the boilerplate code “by hand”:
Yes, but prepareTemplate could add an onCreated callback to add whatever it wants to the template instance, right? Maybe there is something stopping that, in which case we should fix it.
That works for my purposes. I would then have to accept a function with a data parameter. On created I’ll pass this.data to the function so the user can give me the right object.
The second example works because onRendered is slightly misleading, while the template has bee put in the DOM, its child elemnts could still be being rendered