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

20 lines
672 B
Plaintext

import { useEffect } from 'react';
import { isFunction } from '../utils';
import isDev from '../utils/isDev';
var useMount = function (fn) {
if (isDev) {
if (!isFunction(fn)) {
console.error("useMount: parameter `fn` expected to be a function, but got \"".concat(typeof fn, "\"."));
}
}
useEffect(function () {
var result = fn === null || fn === void 0 ? void 0 : fn();
// If fn returns a Promise, don't return it as cleanup function
if (result && typeof result === 'object' && typeof result.then === 'function') {
return;
}
return result;
}, []);
};
export default useMount;