Continuing on from the Ender inter-module communication issue, specifically where bonzo.remove() can leave you with Bean event handlers still attached so you don't have a proper clean-up.
The approach I've taken here is to create an extension / hooks / callbacks mechanism for Bonzo in the form of bonzo._extend(type, fn). Where type is just 'remove' at the moment but could be easily expanded to other extension points. I've shifted the existing clearData() into the extension list and then in the Ender bridge I've lazily detected Bean and if it exists I put in a call to bean.remove(el) in the extension list as well so Bean gets to clean up each time an element is removed from the DOM by Bonzo.
A pull request for discussion purposes.
Continuing on from the Ender inter-module communication issue, specifically where
bonzo.remove()
can leave you with Bean event handlers still attached so you don't have a proper clean-up.The approach I've taken here is to create an extension / hooks / callbacks mechanism for Bonzo in the form of
bonzo._extend(type, fn)
. Wheretype
is just'remove'
at the moment but could be easily expanded to other extension points. I've shifted the existingclearData()
into the extension list and then in the Ender bridge I've lazily detected Bean and if it exists I put in a call tobean.remove(el)
in the extension list as well so Bean gets to clean up each time an element is removed from the DOM by Bonzo.What think you?