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

removing event handlers will create DOMEventManagerElement's #560

Open
onnlucky opened this issue Jan 16, 2018 · 2 comments
Open

removing event handlers will create DOMEventManagerElement's #560

onnlucky opened this issue Jan 16, 2018 · 2 comments

Comments

@onnlucky
Copy link
Collaborator

On init and on destroy of a layer, event handlers are removed from elements that sometimes don't even have handlers. The problem is this will call the getter layer._domEventHandler and will create a needless DOMEventManagerElement just so all handlers can be removed.

For example, @define "constraintValues" calls @off "change:parent", @parentChanged when set with null, which is done when applying defaults.

Also in Layer.destroy(), @_context.emit("layer:destroy", @) will trigger code that has the same effect.

All that work is just wasteful. Especially for Layers that never actually have any dom event handlers.

@jordandobson
Copy link
Contributor

jordandobson commented Jan 16, 2018

So are you suggesting removing the layer:destroy event? We definitely need to keep this around so we know when a layer is destroyed.

I understand not firing the change:parent when set to null during initialization... If that's what you are saying.

@onnlucky
Copy link
Collaborator Author

Any code that calls @off for event handlers, will implicitly create a dom even wrapper because it is created in a getter. We need an alternative to the default getter that will not create a wrapper, and places that use it can skip a lot of work if there never was a wrapper.

I am not proposing to remove "layer:destroy", only to make the code that emits it follow the same code path that avoids creating needless wrappers.

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

2 participants