/**
 * @module tgam-patterns/dom-methods
 */

/**
 * @method getScrollbarWidth
 * @description gets the scrollbar width
 * @returns {Number}
 */
export function getScrollbarWidth() {
  var scrollDiv = document.createElement("div");
  scrollDiv.className = "u-scrollbar-measure";
  document.body.appendChild(scrollDiv);

  const scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;

  document.body.removeChild(scrollDiv);

  return scrollbarWidth;
}
