# @electron-helpers/window-manager

> Easily manage electron windows.

Latest version **1.1.0** (published 2018-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @electron-helpers/window-manager
pnpm add @electron-helpers/window-manager
yarn add @electron-helpers/window-manager
bun add @electron-helpers/window-manager
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-08-14 |
| First published | 2018-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tamas Pap |
| Maintainers | tamas-pap |
| Keywords | electron, window, manager |

## Links

- npm: https://www.npmjs.com/package/@electron-helpers/window-manager
- Repository: https://github.com/tamas-pap/electron-window-manager
- Homepage: https://github.com/tamas-pap/electron-window-manager#readme
- Issues: https://github.com/tamas-pap/electron-window-manager/issues
- npm.io page: https://npm.io/package/@electron-helpers/window-manager

## Dependencies (2)

- [is-url](https://npm.io/package/is-url.md) ^1.2.4
- [@electron-helpers/window-positioner](https://npm.io/package/@electron-helpers/window-positioner.md) ^1.0.0

## Recent versions

- 1.1.0 (latest) — 2018-08-14

## README

# Electron Window Manager [![Build Status](https://travis-ci.org/tamas-pap/electron-window-manager.svg?branch=master)](https://travis-ci.org/tamas-pap/electron-window-manager)

> Easily manage electron windows.

## Install

```
npm install --save @electron-helpers/window-manager
```

## Usage

### Create a new window

```Javascript
const { createWindow } = require('@electron-helpers/window-manager');
const settingsWindow = createWindow('settings', 'https://localhost:3000/settings', { width: 420, height: 540 }, { x: 'center', y: 100 });
```

### Get a window by name

```Javascript
const { getWindow } = require('@electron-helpers/window-manager');
const settingsWindow = getWindow('settings');
```

### Set default window options

```Javascript
const { setDefaultOptions } = require('@electron-helpers/window-manager');
setDefaultOptions({ backgroundColor: '#fff' });
```

### Get default window options

```Javascript
const { getDefaultOptions } = require('@electron-helpers/window-manager');
const defaultOptions = getDefaultOptions();
```

### Set base URL

```Javascript
const { setBaseURL, createWindow } = require('@electron-helpers/window-manager');
setBaseURL('https://localhost:3000/');
...
const settingsWindow = createWindow('settings', 'settings', { width: 420, height: 540 }, { x: 'center', y: 100 });
```

## Docs

### `createWindow(name, url, options, position, showGracefully)`

Creates a new `BrowserWindow`.

* `name` - `String` - the name of the window
* `url` - `String` - the url to open in the window
* `position` - `Object` - the position of the window. e.g. `{ x: 'left', y: 'center', xOffset: 10, yOffset: -10}` will position the window to 10 pixel from the left (horizontally) and -10 pixels from the center of the screen (vertically)
* `showGracefully` - `Boolean` - whether to show the windown only [when ready](https://github.com/electron/electron/blob/master/docs/api/browser-window.md#showing-window-gracefully).

### `getWindow(name)`

Returns a window by it's name.

* `name` - `String`

### `setDefaultOptions(options)`

Sets the default options.

* `options` - `Object`

### `getDefaultOptions(options)`

Returns default options.

* `options` - `Object`

## License

MIT

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