import isHTMLElement from './isHTMLElement';

/**
 * 进入全屏显示
 * @param {*} element
 */
function requestFullscreen(element) {
  if (!isHTMLElement(element)) element = document.documentElement;
  var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;

  if (requestMethod) {
    requestMethod.call(element);
  } else if (window.ActiveXObject) {
    // eslint-disable-next-line
    new ActiveXObject('WScript.Shell').SendKeys('{F11}');
  }
}

export default requestFullscreen;
