import PageSetup from './setup/PageSetup' ; import checkSetupEnv from './checkSetupEnv' ; type FullMethods = Required < tinyapp . IPageOptionsMethods > ; export default function usePageLifeCycle < F extends keyof FullMethods > ( name , fn ) { checkSetupEnv ( 'usePageLifeCycle' , [ 'page' ] ) ; const setup = PageSetup . getCurrent < PageSetup > ( ) ; setup . addMethod ( name , fn ) ; }