Skip to content

Environment Helpers

A file that contains a list of multiple ways to interact with environment variables.

Helpers

Here are the current environment helpers that are available.

Global Variables:

window.USER_CAN_TOUCH boolean User is on a device that supports 'touchstart'

window.USER_CAN_HOVER boolean User is on a device that supports 'mouseover'

Session Storage Keys/Properties:

USER_CAN_TOUCH boolean User is on a device that supports 'touchstart'

USER_CAN_HOVER boolean User is on a device that supports 'mouseover'

CSS Classes:

html.js: User has javascript enabled

html.no-js: User does not have javascript enabled

html.touch: User is on a device that supports 'touchstart'

html.hover: User is on a device that supports 'mouseover'

Installation

Terminal

Terminal
pnpm add @mvps-genesis/environment-helpers

Example Usage

Javascript

import "@mvps-genesis/environment-helpers";