import { useEffectOnce } from 'react-use';

import useLocalStorageState from 'use-local-storage-state';
import { StorageKeys } from '@/shared/constants/local-storage';
import { setAfterPageRendered } from '@/shared/lib';

export const useAppPagingSpeed = () => {
  return useLocalStorageState(StorageKeys.AppPagingSpeed, { defaultValue: '250' });
};

export const useEffectOnceAfterPageRendered = (callback: () => void) => {
  useEffectOnce(() => {
    setAfterPageRendered(callback);
  });
};
