Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssr-window

Package Overview
Dependencies
Maintainers
1
Versions
21
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

  • 4.0.0-beta.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
784K
decreased by-20.98%
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

FAQs

Package last updated on 22 Jul 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc