-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Comments
Yes, it's true, this methods using for internal purposes in monkberry. It's not like lifecycle methods. |
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? |
Sorry, no, now main main goal is to finish next version. |
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 :) ? |
It’s still in early age. It’s difficult to explain what’s going on there, sorry. |
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.
The text was updated successfully, but these errors were encountered: