diff --git a/src/helpers.ts b/src/helpers.ts index 9706994..b523732 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -35,13 +35,13 @@ export function truncate( export function getRandomId() { const arr = new Uint32Array(1) - global.crypto.getRandomValues(arr) + crypto.getRandomValues(arr) return arr[0].toString(36) } export function getRandomNumber(min: number, max: number) { const arr = new Uint32Array(1) - global.crypto.getRandomValues(arr) + crypto.getRandomValues(arr) const random = arr[0] const range = max - min return Math.floor((random / (0xffffffff + 1)) * range + min) diff --git a/src/hooks.ts b/src/hooks.ts index 83b52e7..338e929 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -24,18 +24,18 @@ export function usePointerPosition() { } useAnimationFrame(() => { - if (!global.window) return + if (!window) return - global.window.addEventListener('pointerenter', updatePosition, false) - global.window.addEventListener('pointermove', updatePosition, false) + window.addEventListener('pointerenter', updatePosition, false) + window.addEventListener('pointermove', updatePosition, false) return () => { - global.window.removeEventListener( + window.removeEventListener( 'pointermove', updatePosition, false, ) - global.window.removeEventListener( + window.removeEventListener( 'pointerenter', updatePosition, false, diff --git a/src/utils.ts b/src/utils.ts index 1b3100a..33f7b83 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,3 +1,2 @@ export const isTouchDevice = - global.window && - ('ontouchstart' in global.window || navigator.maxTouchPoints > 0) + window && ('ontouchstart' in window || navigator.maxTouchPoints > 0)