This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
[core] Similar to tick
late-tick
etc., also offer mount
and unmount
(or similar)
#48
Labels
enhancement
New feature or request
Milestone
We currently have a convenient way of running code in every frame, but if we want to run code when an element appears (or disappears), we currently have to drop into the imperative layer or, worse, build our own class extending
ThreeElement
and overloadingmountedCallback
and friends.It would be nice if we could add code that is run when the element appears (and disappears) by setting a property or attribute, just like we can do with ticker events.
These new attributes could be named something like
mount
andunmount
, orappear
anddisappear
, or something similar.There's an opportunity here to make them real DOM events, but I think that would be a mistake; if there's a large number of objects appearing or disappearing, it would have a significant impact on performance (and memory/GC). So, just like the ticker callbacks, these need to run through an EventEmitter, which means we'll have to add one of those guys to
BaseElement
.Checklist:
The text was updated successfully, but these errors were encountered: