All files Context.tsx

100% Statements 7/7
50% Branches 2/4
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20        1x 1x   1x 1x     1x             1x  
import React from 'react';
 
let doc;
let win;
Eif (typeof document !== 'undefined') {
  doc = document;
}
Eif (typeof window !== 'undefined') {
  win = window;
}
 
export const FrameContext = React.createContext<ContextProps>({ document: doc, window: win });
 
interface ContextProps {
  document?: Document | null;
  window?: Window | null;
}
 
export const useFrame = () => React.useContext<ContextProps>(FrameContext);