import useContextType from './useContextType' ; import { default as App , app } from './App' ; export default function useGlobalFetchInitData ( fn , isAsync = true , passInApp ? ) { const realGlobal = passInApp || app ; const type = useContextType ( ) ; if ( type === 'react' ) { realGlobal . initData . addFetchInitDataMethod ( fn , isAsync ) ; } else { throw new Error ( `Wrong context: ${ type }` ) ; } }