In the timeFilter.jswillDestroy method, the element returns null. The time filter component’s elements are removed before willDestroy is triggered, so the MyComponentsdestroy() method cannot be performed. I want to call the MyComponentsdestroy() method before the component is destroyed.
I think you probably want to use a modifier – as modifiers are meant for managing elements, whereas components are more like a compound collection of things – refactoring and encapsulation boundaries, rather than something that is meant for micromanaging its contents.
Modifiers are given the element reference directly, so while the modifier is being destroyed, you are still guaranteed access to that element.