fbredius/storybook

View on GitHub
lib/components/src/Zoom/Zoom.tsx

Summary

Maintainability
A
1 hr
Test Coverage
import global from 'global';
import { ZoomElement } from './ZoomElement';
import { ZoomIFrame } from './ZoomIFrame';

const { window: globalWindow } = global;

export const browserSupportsCssZoom = (): boolean => {
  try {
    return (
      globalWindow.document.implementation.createHTMLDocument('').body.style.zoom !== undefined
    );
  } catch (error) {
    return false;
  }
};

export const Zoom = {
  Element: ZoomElement,
  IFrame: ZoomIFrame,
};