function bindLayoutOnResize(grid, delay) {
    if (typeof delay !== NUMBER_TYPE) {
      delay = delay === true ? 0 : -1;
    }

    if (delay >= 0) {
      grid._resizeHandler = debounce(function () {
        grid.refreshItems().layout();
      }, delay);

      window.addEventListener('resize', grid._resizeHandler);
    }
  }
Bind grid's resize handler to window.

@param {Grid} grid
@param {(Number|Boolean)} delay