-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
[v4-beta.18] constants for lifecycle hooks are no longer exported #16760
Comments
What's your use case? |
I need to execute code in response to the didEnter and didLeave events, from the execution context of a directive. I don't know if this use case was never considered or if I missed some design paradigm that would solve this. I could just hardcode them as strings ["ionViewDidEnter"] but that feels like an even worse code smell. The actual use case is for dynamically adding resource intensive listeners (e.g onResize) for the active page and remove them when it leaves - so that we don't keep the onResize listeners for the pages active that aren't visible at the moment. Be aware that this was all developed with ionic3 in mind so maybe it would be better to replace it with a completely different approach, like subscribing to angular router navigation events and then checking if the current directive is on the page with the active route... |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Bug Report
Ionic version:
[x] 4.x
Current behavior:
Since 119e0c1 its impossible to get a reference to the names of the lifecycle hooks (like
LIFECYCLE_DID_ENTER
) as they are no longer exported. I had to import them directly viafrom '@ionic/core/dist/collection/components/nav/constants.js'
and had to add ".js" otherwise jest didn't find the file...
Expected behavior:
LifeCycleHook constants should be exported via any of the index.ts files.
Related code:
https://github.com/ionic-team/ionic/blob/v4.0.0-beta.18/core/src/components/nav/constants.ts
The text was updated successfully, but these errors were encountered: