get-support.js 530 B

1234567891011121314151617
  1. import { getWindow, getDocument } from 'ssr-window';
  2. let support;
  3. function calcSupport() {
  4. const window = getWindow();
  5. const document = getDocument();
  6. return {
  7. smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style,
  8. touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch)
  9. };
  10. }
  11. function getSupport() {
  12. if (!support) {
  13. support = calcSupport();
  14. }
  15. return support;
  16. }
  17. export { getSupport };