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

Improving the moduleChange event #193

Closed
r-arvind opened this issue Jun 26, 2021 · 1 comment
Closed

Improving the moduleChange event #193

r-arvind opened this issue Jun 26, 2021 · 1 comment

Comments

@r-arvind
Copy link

One issue with the moduleChange event is that it is dispatched at the beginning of the module change process.

For example, let's say a user is switching from module "A" to module "B" and I want to make some modifications to the nodes on "B" when this module change event occurs. Right now this is not possible as the nodes haven't been loaded yet. Searching for node in B using it's classname (document.querySelector(classname)) returns null.

It can be articulated further into two events like moduleWillChange and moduleDidChange which will provide a finer controller over this event

@r-arvind
Copy link
Author

Nevermind, I think I found out what the issue is. I was using mutations to add classnames based on #180
The mutation events were happening after the moduleChange event is fired. Hence the document.querySelector was returning null. My bad.

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

No branches or pull requests

1 participant