I found out that 'getWitht' is CPU consuming if there is a lot of $digest.
So instead of using $watch, ResizeObserver in chrome is a better choice.
if (ResizeObserver) {
//window.console.log("ResizeObserver exists", ResizeObserver);
new ResizeObserver((outputsize) => {
getWidth();
setWidth();
}).observe(cell[0]);
} else {
//window.console.log("ResizeObserver does not exists", ResizeObserver);
var listener = scope.$watch(getWidth, setWidth);
}
Also, "scope.$watch(cells, updateCells);" is not need, I think, if the number of cells in header does not change. It can be replace directly by "updateCells();"
I found out that 'getWitht' is CPU consuming if there is a lot of $digest. So instead of using $watch, ResizeObserver in chrome is a better choice.
Also, "scope.$watch(cells, updateCells);" is not need, I think, if the number of cells in header does not change. It can be replace directly by "updateCells();"