Socket
Socket
Sign inDemoInstall

electron-positioner

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    electron-positioner

Helps positioning your electron windows.


Version published
Weekly downloads
2.1K
decreased by-10.89%
Maintainers
1
Install size
6.78 kB
Created
Weekly downloads
 

Readme

Source

Electron-positioner Build Status js-standard-style

Helps positioning your electron windows.

Install

npm install --save electron-positioner

Usage

var Positioner = require('electron-positioner')
var positioner = new Positioner(browserWindow)

// Moves the window top right on the screen.
positioner.move('topRight')

// Returns `{x,y}`
positioner.calculate('trayCenter', trayBounds)

Note, trayBounds is only required with the positions that starts with tray.

Docs

new Positioner (browserWindow)

Constructor

BrowserWindow

The BrowserWindow instance.

calculate (position, trayBounds)

Returns coordinates {x,y}.

move (position, trayBounds)

Moves the window with BrowserWindow.setPosition()

position

A string telling where to place the window. Allowed values:

  • trayLeft
  • trayBottomLeft
  • trayRight
  • trayBottomRight
  • trayCenter
  • trayBottomCenter
  • topLeft
  • topRight
  • bottomLeft
  • bottomRight
  • topCenter
  • bottomCenter
  • leftCenter
  • rightCenter
  • center
trayBounds

Tray bounds, only needed for the following positions:

  • trayLeft
  • trayBottomLeft
  • trayRight
  • trayBottomRight
  • trayCenter
  • trayBottomCenter

Tests

npm test

License

MIT

FAQs

Last updated on 24 Aug 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc