Template onCreated before templates:forms package
Hi,
I think there is no clean way to install a created (or any other) hook before createFactory is called.
I thought about a PR, but in any way i think of it it's not backward compatible.
- Use case: a template producing
action,schemaanddataarguments from somecollectionandidtemplate arguments.
Workaround for onCreated:
Template.form.onCreated ->
## some custom init
reactiveForms.createFormBlock
template: 'form'
submitType: 'normal'
Template.form.onCreated Template.created
delete Template.form.created
Is there any chance for the future to switch to using onCreate at register time, and announce the breaking chage?
I'm confused about what you are trying to accomplish here. All you need to do to run your own created callback before the package's created callback is call onCreated before you register the template.
Yes, i'm creating a lib, and want to be able to pass collection and id instead of schema and action.
In module.js Line 1360 and 1426 this package uses the deprecated template.created callback setter which runs before any onCreated callbacks.
So even when installing an onCreated callback before ReactiveForms.create(Formblock|Element) it is run only after the templates:forms callback.
Ah. I thought I fixed that a long time ago. I guess I forgot!
I will publish an update soon with this fix.
Just reminding you that this is a breaking change though :smile:.