4.0.2 • Published 2 years ago

ssr-window v4.0.2

Weekly downloads
507,343
License
MIT
Repository
github
Last release
2 years ago

SSR Window

Better handling for window and document object in SSR environment.

This library doesn't implement the DOM (like JSDOM), it just patches (or creates window and document objects) to avoid them to fail (throw errors) during server-side rendering.

Was created for use in:

Installation

Library available on NPM:

npm i ssr-window

Usage

import { window, document } from 'ssr-window';

window.addEventListener('resize', () => {});

const div = document.querySelectorAll('div');

Extending

If you rely on some window/document properties which are not included here, you can use extend helper to add them:

import { window, document, extend } from 'ssr-window';

// add window.navigator.language
extend(window, {
  navigator: {
    language: 'en',
  },
});

// add document.body
extend(document, {
  body: {
    /* ... */
  },
});

Contribution

Yes please! See the contributing guidelines for details.

Licence

This project is licensed under the terms of the MIT license.

wtdsadasffgffdsfsssssssswtdsadasffgffdsfssssssss1wtdsadasffgffdsfssssssss11fhgushdhsdhfdhsgfhdlllllfffffghhhhhhhhhhhhhjjjjjjjjjjjjdemo2dfsofhisoig35467fsdfgfhjjscfhsifudemo2dfsofhisoig35467fsdfgfhjjscfhsifufklshfdemo2ifdemo2ifjknfnffdemo2ifufklshdsfsdff11demo2ifufklshfswiper-rtlor-ui-dione@byorbit/or-ui-lentus@byhuz/or-ui-lentusor-ui-sculptorisframework7-envisionframework7-envision2dmitryn-swiperjszb-swiper@easy-connect/webshop@yourssu/design-system@master/angularpouria-swiperswiper-vue2-css@infinitebrahmanuniverse/nolb-ssrnpm1dasgsakjdgsadknpmasdaysdgasjhdhjasdghjasdjhsjnpmqwertyuiuopasdsdasda123333333sdgfhdsghjfdhjdfghdfhgfdjhgdfhghsdgfhgdfhghhfgjdfhjghdfkghdfjhgkdfjs-aaaaa@everything-registry/sub-chunk-2816library-button-testlibrary-button-test-srcliujie1233221html2hyz-swiperleijinzhoudileijeuxuiliuadadasdaaasfmyweb111migrate-swiper5-8headless-carouseljs-asdasdasdjsakjhshjkdwnative-jsbridgenbnbnbnbnbnbnbmeiyoumiaoshunpmdemo-wyd-dddddddddddddnpmdemo-wyd-wangyudingnpmdemo-yougongpingnpmdemo-lbwnpmdemo-libomnnhjsjsnpmqswaknpmqswhhhhholaknpmsdfghjknpmhghghghghghghnpm-lkhgfdfghbjnkmldrfcvbnmduinum-zxcvbnmlkjhgfdsaqwertnpmdemo-wang-wangyudingelham-swiperdwadwadjwoadjwguoyujieerbifirejsxfire-react-jsx-ssrfhreuifhuihuiebgiuframework7framework7-cnframework7-kartaf7-envisionf7rtlnpm-xiaozhenshengqwererttyyuuijuasdfghjkzxcvbnmwertyujwsedfvbxcfghyuirtghqwerty-pollolkedoooooooooooooooooooooooooooooooooopoligonosapppolihfhgghgsgshjfsdfsfhhhsfsfreact-helmet-async-tsor-ui-basepatagoniachic-react-uizx-editor@duyank/swiperzyjyyds@goodgamestudios/swiper4@egman1/swiper@egman1/swiper_old@eolme/vma-polyfill@emotionagency/smoothscroll@flownet/ui-yanyan@fork-libs/swiper@jianghe/sand-editorvarela-uitestethrhtj@mdui/jq@mdui/shared@interdan/public-ui
4.0.2

2 years ago

4.0.1

2 years ago

4.0.0

3 years ago

4.0.0-beta.3

3 years ago

4.0.0-beta.2

3 years ago

4.0.0-beta.1

3 years ago

3.0.0

3 years ago

3.0.0-alpha.4

4 years ago

3.0.0-alpha.3

4 years ago

2.0.0

4 years ago

2.0.0-beta.8

4 years ago

3.0.0-alpha.1

4 years ago

3.0.0-alpha.2

4 years ago

2.0.0-beta.7

4 years ago

2.0.0-beta.6

4 years ago

2.0.0-beta.5

4 years ago

2.0.0-beta.4

4 years ago

2.0.0-beta.3

4 years ago

2.0.0-beta.2

4 years ago

1.0.1

6 years ago

1.0.0

6 years ago