useSupportWebGL.ts
337 Bytes
/**
* 判断浏览器是否支持webgl
*/
export const useDetectWebGLContext = () => {
const canvas = document.createElement('canvas')
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
if (gl && gl instanceof WebGLRenderingContext) {
return true
} else {
return false
}
}