vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
9 lines (8 loc) • 517 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBrowser = isBrowser;
function isBrowser() {
// Using `typeof window !== 'undefined'` alone is not enough because some users use https://www.npmjs.com/package/ssr-window
return typeof window !== 'undefined' && typeof window.scrollY === 'number';
// Alternatively, test whether environment is a *real* browser: https://github.com/brillout/picocolors/blob/d59a33a0fd52a8a33e4158884069192a89ce0113/picocolors.js#L87-L89
}