Files
NapCatQQ/.pnpm-store/v3/files/81/a8417682e7ab2e3f7acaaefe7dd4fc300d7e7034faee2182a7c61ca37e629c6fb7da16ce7ed27dba73c8db38702e106716b040bd6c513242576f53bfcb127f
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

20 lines
576 B
Plaintext

import { useEffect, useRef } from 'react';
import useUnmount from '../useUnmount';
import isBrowser from '../utils/isBrowser';
var DEFAULT_OPTIONS = {
restoreOnUnmount: false,
};
function useTitle(title, options) {
if (options === void 0) { options = DEFAULT_OPTIONS; }
var titleRef = useRef(isBrowser ? document.title : '');
useEffect(function () {
document.title = title;
}, [title]);
useUnmount(function () {
if (options.restoreOnUnmount) {
document.title = titleRef.current;
}
});
}
export default useTitle;