ray-template/__test__/utils/canUseDom.ts
2024-03-29 16:25:09 +08:00

17 lines
297 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
*
* @description
* 判断是否可以操作 DOM。
*
* 如果可以操作 DOM,则返回 true,否则返回 false。
*/
const canUseDom = () => {
return !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
)
}
export default canUseDom