# xwindow

> This module exports a cross-platform window instance object.

Latest version **0.3.0** (published 2023-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install xwindow
pnpm add xwindow
yarn add xwindow
bun add xwindow
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2023-06-08 |
| First published | 2022-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14.19 |
| Dependencies | 1 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vyacheslav Aristov |
| Maintainers | aristov |
| Keywords | cross-platform, document, dom, jsdom, window |

## Links

- npm: https://www.npmjs.com/package/xwindow
- Repository: https://github.com/aristov/xwindow
- Homepage: https://github.com/aristov/xwindow#readme
- Issues: https://github.com/aristov/xwindow/issues
- npm.io page: https://npm.io/package/xwindow

## Dependencies (1)

- [jsdom](https://npm.io/package/jsdom.md) ^22.1.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2023-06-08
- 0.2.0 — 2022-10-10
- 0.1.2 — 2022-05-18
- 0.1.1 — 2022-05-17
- 0.1.0 — 2022-05-15

## README

# xwindow

[![NPM Version](https://img.shields.io/npm/v/xwindow.svg)](https://www.npmjs.com/package/xwindow)
[![Node.js CI](https://github.com/aristov/xwindow/actions/workflows/node.js.yml/badge.svg)](https://github.com/aristov/xwindow/actions/workflows/node.js.yml)
[![Coverage Status](https://coveralls.io/repos/github/aristov/xwindow/badge.svg?branch=master)](https://coveralls.io/github/aristov/xwindow?branch=master)

This module exports a cross-platform window instance object.

* In the browser it just exports the global window object
* In NodeJS, it exports the newly created [JSDOM](https://www.npmjs.com/package/jsdom) window instance

Thus, DOM-dependent modules become compatible and can be used both in NodeJS and in the browser.

## Installation

```shell
npm install xwindow
```

## Usage

ES2015

```js
import window from 'xwindow'
```

CommonJS

```js
const window = require('xwindow')
```

## Example

```js
import window from 'xwindow'

const { document, CustomEvent, DocumentFragment, Node } = window

const node = document.createElement('div')
const fragment = new DocumentFragment

fragment.append(node)

if(node.nodeType === Node.ELEMENT_NODE) {
  node.dispatchEvent(new CustomEvent('answer', { detail : 42 }))
}
```

## License

[The MIT License (MIT)](https://raw.githubusercontent.com/aristov/xwindow/master/LICENSE)

---
_Source: https://npm.io/package/xwindow · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
