hi,
finally i think i've found a solution which works, but i'm not 100% sure if it's a real solution for all modern browsers.
I've figured out that mutation events fire after rendering, thus this custom binding can be used to react to gui changes (example tracks height changes and requires jquery):
// <div data-bind="afterguichange:{ once: function(h){ console.log('once'+h); }}"> </div>
ko.bindingHandlers['afterguichange'] = {
'init': function (element, valueAccessor) {
var elementsHeight = $(element).height();
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var e = $(element);
if((mutation.type == 'attributes') &&
mutation.attributeName == 'style'||
mutation.attributeName == 'class'){
var hhh =e.height();
if(elementsHeight != hhh){
if(typeof valueAccessor().once == 'function') valueAccessor().once(hhh);
elementsHeight = hhh;
}
}
});
});
observer.observe(element, { attributes: true, childList: true, characterData: true });
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
observer.disconnect();
});
}
}