Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifecycle methods are overridden #27

Open
Madumo opened this issue Aug 16, 2016 · 5 comments
Open

Lifecycle methods are overridden #27

Madumo opened this issue Aug 16, 2016 · 5 comments

Comments

@Madumo
Copy link

Madumo commented Aug 16, 2016

There is three methods that seem to act as lifecycle methods on the components: onRender, onUpdate and onRemove.

But the Monkberry constructor is setting them to null, and then the component constructor may set them to a function, like when you use a directive.

Because of that, you can't just declare an onRender method that call super.onRender() in your component class. It will get overridden. Right now if you want to do something on onRender or onRemove, you have to keep the ref of the current method within the constructor, assign a new method that do your stuff and also call the previous method.

It would be great if we could just create the lifecycle methods within our class and just call the super one if needed.

@antonmedv
Copy link
Owner

Yes, it's true, this methods using for internal purposes in monkberry. It's not like lifecycle methods.
But i think we can add lifecycle events with more native naming and rename onRender to something like __onRender__.

@Madumo Madumo mentioned this issue Sep 8, 2016
@wellcaffeinated
Copy link

Looks like there was a PR #31 for this but it was never merged. I'm trying to use monkberry for a project (and love it) but i really need lifecycle methods. Any chance you could bump the version and add this feature?

@antonmedv
Copy link
Owner

Sorry, no, now main main goal is to finish next version.

@wellcaffeinated
Copy link

Fair enough, is there any way I can help? If I push this feature to the next branch can you instruct me on how to use the new branch in my project :) ?

@antonmedv
Copy link
Owner

It’s still in early age. It’s difficult to explain what’s going on there, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants