When handle closing resources or removing a DOM node, I use code like the following in several places:
if (appNode && appNode.dispatchEvent) {
appNode.dispatchEvent(new CustomEvent('resourcewillchange'))
}
Should address supply an API for doing this?
💡 One idea I had was to do something like...
define([ '@zambezi/address/lib/address', '@zambezi/address/lib/unregister'], function(address, unregister) {
return function (req, res) {
res(ok(view))
function view(node) {
var panelNode = createPanelNode(node)
address('/my/app/notifications-panel').into(panelNode).get()
node.addEventListener('app_closing', function() {
unregister(panelNode)
getPanelContainerNode(node).removeChild(panelNode)
})
}
}
})