From e6e09a8a7cd1911a964e018e24b9ab7d37d1dad5 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Fri, 28 Aug 2015 22:24:54 -0700 Subject: [PATCH] Standardize screen --- docs/api/screen.md | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/docs/api/screen.md b/docs/api/screen.md index bc93ec5f..c22530ca 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -1,11 +1,14 @@ # screen -Gets various info about screen size, displays, cursor position, etc. You should -not use this module until the `ready` event of `app` module gets emitted. +The `screen` module retrieves information about screen size, displays, cursor +position, etc. You should not use this module until the `ready` event of the +`app` module is emitted. `screen` is an [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter). -Make sure to note that in the renderer / DevTools, `window.screen` is a reserved DOM property, so writing `screen = require('screen')` won't work. In our examples below, we use `atomScreen` as the variable name instead. +**Note**: In the renderer / DevTools, `window.screen` is a reserved +DOM property, so writing `var screen = require('screen')` will not work. In our +examples below, we use `atomScreen` as the variable name instead. An example of creating a window that fills the whole screen: @@ -50,43 +53,57 @@ app.on('ready', function() { }); ``` -## Event: display-added +## Events + +The `screen` module emits the following events: + +### Event: 'display-added' + +Returns: * `event` Event * `newDisplay` Object Emitted when `newDisplay` has been added. -## Event: display-removed +### Event: 'display-removed' + +Returns: * `event` Event * `oldDisplay` Object Emitted when `oldDisplay` has been removed. -## Event: display-metrics-changed +### Event: 'display-metrics-changed' + +Returns: * `event` Event * `display` Object * `changedMetrics` Array -Emitted when a `display` has one or more metrics changed, `changedMetrics` is +Emitted when one or more metrics change in a `display`. The `changedMetrics` is an array of strings that describe the changes. Possible changes are `bounds`, `workArea`, `scaleFactor` and `rotation`. -## screen.getCursorScreenPoint() +## Methods + +The `screen` module has the following methods: + +### `screen.getCursorScreenPoint()` Returns the current absolute position of the mouse pointer. -## screen.getPrimaryDisplay() +### `screen.getPrimaryDisplay()` Returns the primary display. -## screen.getAllDisplays() +### `screen.getAllDisplays()` Returns an array of displays that are currently available. -## screen.getDisplayNearestPoint(point) +### `screen.getDisplayNearestPoint(point)` * `point` Object * `x` Integer @@ -94,7 +111,7 @@ Returns an array of displays that are currently available. Returns the display nearest the specified point. -## screen.getDisplayMatching(rect) +### `screen.getDisplayMatching(rect)` * `rect` Object * `x` Integer -- 2.43.0