Closed Hypercubed closed 9 years ago
Great catch. Yes, there is a listener leak here. I think your first suggestion looks good. The destroy function will get invoked if the layout is removed from the Chiasm configuration. So, in the case you are wanting to tear down the whole Chiasm runtime, you can set the config object to {}
, which should cause the destroy
function to be invoked on all components present (including layout).
Thank you for finding this.
After the element is removed and the model is no longer referenced the window resize event listener in the layout plugin (here https://github.com/curran/chiasm/blob/gh-pages/src/plugins/layout/layout.js#L35) remains. We can add the following to the layout plugin:
But I think the plugins
destroy
methods still need to be called manually using something like: