DockYard / ember-in-viewport

Detect if an Ember View or Component is in the viewport @ 60FPS
MIT License
245 stars 91 forks source link

Handle glimmer components #180

Closed gossi closed 5 years ago

gossi commented 5 years ago

Since the ember-in-viewport addon mostly works through the mixin, it is impossible to use with native classes / glimmer components. Can the latter also be supported?

Maybe a combination of modifiers/decorators? 😬

snewcomer commented 5 years ago

@gossi yep I added modifier support recently. Part of those changes are my medium term goal to move the logic to a service/manager in order to facilitate different constructs.

snewcomer commented 5 years ago

Lmk if you have any other questions. Would be happy to help!

gossi commented 5 years ago

I like the idea for the modifier. It's still WIP if I understand the readme correctly. If it's moving forward, I'm fine with what's coming.

I have more concerns about the mixin. Glimmer components use native classes and they don't support mixins. Maybe a decorator instead, if that will do the job? Then it can be something like this:

I don't mind helping out here :)

snewcomer commented 5 years ago

@gossi modifier support I think is baked in now with the did-insert modifier. Adding a modifier would be unnecessary with the existing tools we have but let me know if you think otherwise.

The next thing I am working on is a service approach to make the mixin optional, which requires a registry of elements. Hopefully will get that done by the end of the month at which time we can explore decorators? What do you think of this plan?

gossi commented 5 years ago

Sounds good. If you planning on opening a PR for this, then ping me. So I can provide you with feedback in early development stage from the perspective of a consumer to this library.