ReleaseHook for middleware
tbranyen opened this issue · 2 comments
tbranyen commented
A new middleware hook for when vTree
s get released from calling release
. I need a way to ensure consistent cleanup in the components testing repo.
It would work like the following:
const { innerHTML, use, release } = require('diffhtml');
const { assign } = Object;
use(assign(() => {}, {
releaseHook(vTree) {
// Do some additional cleanup with the VTree.
}
}));
innerHTML(document.body, '<div />');
release(document.body);
mAAdhaTTah commented
This is something mostly used by tests? Seems straightforward enough. 👍
tbranyen commented
Yup! Basically I maintain caches in the diffhtml-components implementation that are separate from the core caches. I want to assert these are properly emptied on a per test basis.