🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ssr-window

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssr-window

Better handling for window object in SSR environment

5.0.1
latest
Source
npm
Version published
Weekly downloads
900K
-7.59%
Maintainers
1
Weekly downloads
 
Created

What is ssr-window?

The ssr-window package provides a simple way to handle window and document objects in server-side rendering (SSR) environments. It allows developers to use window and document objects without worrying about SSR compatibility issues.

What are ssr-window's main functionalities?

Window Object

This feature allows you to use the window object in an SSR environment. The code sample demonstrates how to access the window's innerWidth property.

const { window } = require('ssr-window');
console.log(window.innerWidth);

Document Object

This feature allows you to use the document object in an SSR environment. The code sample demonstrates how to create a new div element and set its innerHTML.

const { document } = require('ssr-window');
const div = document.createElement('div');
div.innerHTML = 'Hello, world!';
console.log(div.outerHTML);

Custom Window and Document

This feature allows you to create custom window and document objects by extending the default ones provided by ssr-window. The code sample demonstrates how to add custom properties and methods.

const { window, document } = require('ssr-window');
const customWindow = { ...window, customProperty: 'customValue' };
const customDocument = { ...document, customMethod: () => 'customMethod' };
console.log(customWindow.customProperty);
console.log(customDocument.customMethod());

Other packages similar to ssr-window

Keywords

ssr

FAQs

Package last updated on 27 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts