docs: Make tray.md follow docs style guide
authorCheng Zhao <zcbenz@gmail.com>
Tue, 21 Jun 2016 07:20:33 +0000 (16:20 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 21 Jun 2016 07:20:33 +0000 (16:20 +0900)
docs/api/tray.md

index 7e0cc65..aed699b 100644 (file)
@@ -5,17 +5,17 @@
 ```javascript
 const {app, Menu, Tray} = require('electron')
 
-let appIcon = null
+let tray = null
 app.on('ready', () => {
-  appIcon = new Tray('/path/to/my/icon')
+  tray = new Tray('/path/to/my/icon')
   const contextMenu = Menu.buildFromTemplate([
     {label: 'Item1', type: 'radio'},
     {label: 'Item2', type: 'radio'},
     {label: 'Item3', type: 'radio', checked: true},
     {label: 'Item4', type: 'radio'}
   ]);
-  appIcon.setToolTip('This is my application.')
-  appIcon.setContextMenu(contextMenu)
+  tray.setToolTip('This is my application.')
+  tray.setContextMenu(contextMenu)
 })
 ```
 
@@ -49,21 +49,18 @@ rely on the `click` event and always attach a context menu to the tray icon.
 
 Creates a new tray icon associated with the `image`.
 
-## Events
+### Instance Events
 
 The `Tray` module emits the following events:
 
-**Note:** Some events are only available on specific operating systems and are
-labeled as such.
-
-### Event: 'click'
+#### Event: 'click'
 
 * `event` Event
   * `altKey` Boolean
   * `shiftKey` Boolean
   * `ctrlKey` Boolean
   * `metaKey` Boolean
-* `bounds` Object - the bounds of tray icon.
+* `bounds` Object _macOS_ _Windows_ - the bounds of tray icon.
   * `x` Integer
   * `y` Integer
   * `width` Integer
@@ -71,9 +68,7 @@ labeled as such.
 
 Emitted when the tray icon is clicked.
 
-**Note:** The `bounds` payload is only implemented on macOS and Windows.
-
-### Event: 'right-click' _macOS_ _Windows_
+#### Event: 'right-click' _macOS_ _Windows_
 
 * `event` Event
   * `altKey` Boolean
@@ -88,7 +83,7 @@ Emitted when the tray icon is clicked.
 
 Emitted when the tray icon is right clicked.
 
-### Event: 'double-click' _macOS_ _Windows_
+#### Event: 'double-click' _macOS_ _Windows_
 
 * `event` Event
   * `altKey` Boolean
@@ -103,85 +98,82 @@ Emitted when the tray icon is right clicked.
 
 Emitted when the tray icon is double clicked.
 
-### Event: 'balloon-show' _Windows_
+#### Event: 'balloon-show' _Windows_
 
 Emitted when the tray balloon shows.
 
-### Event: 'balloon-click' _Windows_
+#### Event: 'balloon-click' _Windows_
 
 Emitted when the tray balloon is clicked.
 
-### Event: 'balloon-closed' _Windows_
+#### Event: 'balloon-closed' _Windows_
 
 Emitted when the tray balloon is closed because of timeout or user manually
 closes it.
 
-### Event: 'drop' _macOS_
+#### Event: 'drop' _macOS_
 
 Emitted when any dragged items are dropped on the tray icon.
 
-### Event: 'drop-files' _macOS_
+#### Event: 'drop-files' _macOS_
 
 * `event`
 * `files` Array - the file path of dropped files.
 
 Emitted when dragged files are dropped in the tray icon.
 
-### Event: 'drag-enter' _macOS_
+#### Event: 'drag-enter' _macOS_
 
 Emitted when a drag operation enters the tray icon.
 
-### Event: 'drag-leave' _macOS_
+#### Event: 'drag-leave' _macOS_
 
 Emitted when a drag operation exits the tray icon.
 
-### Event: 'drag-end' _macOS_
+#### Event: 'drag-end' _macOS_
 
 Emitted when a drag operation ends on the tray or ends at another location.
 
-## Methods
-
-The `Tray` module has the following methods:
+### Instance Methods
 
-**Note:** Some methods are only available on specific operating systems and are
-labeled as such.
+The `Tray` class has the following methods:
 
-### `Tray.destroy()`
+#### `tray.destroy()`
 
 Destroys the tray icon immediately.
 
-### `Tray.setImage(image)`
+#### `tray.setImage(image)`
 
 * `image` [NativeImage](native-image.md)
 
 Sets the `image` associated with this tray icon.
 
-### `Tray.setPressedImage(image)` _macOS_
+#### `tray.setPressedImage(image)` _macOS_
 
 * `image` [NativeImage](native-image.md)
 
 Sets the `image` associated with this tray icon when pressed on macOS.
 
-### `Tray.setToolTip(toolTip)`
+#### `tray.setToolTip(toolTip)`
 
 * `toolTip` String
 
 Sets the hover text for this tray icon.
 
-### `Tray.setTitle(title)` _macOS_
+#### `tray.setTitle(title)` _macOS_
 
 * `title` String
 
 Sets the title displayed aside of the tray icon in the status bar.
 
-### `Tray.setHighlightMode(highlight)` _macOS_
+#### `tray.setHighlightMode(highlight)` _macOS_
 
 * `highlight` Boolean
 
 Sets whether the tray icon's background becomes highlighted (in blue)
 when the tray icon is clicked. Defaults to true.
 
-### `Tray.displayBalloon(options)` _Windows_
+#### `tray.displayBalloon(options)` _Windows_
 
 * `options` Object
   * `icon` [NativeImage](native-image.md)
@@ -190,7 +182,7 @@ when the tray icon is clicked. Defaults to true.
 
 Displays a tray balloon.
 
-### `Tray.popUpContextMenu([menu, position])` _macOS_ _Windows_
+#### `tray.popUpContextMenu([menu, position])` _macOS_ _Windows_
 
 * `menu` Menu (optional)
 * `position` Object (optional) - The pop up position.
@@ -202,13 +194,13 @@ be shown instead of the tray icon's context menu.
 
 The `position` is only available on Windows, and it is (0, 0) by default.
 
-### `Tray.setContextMenu(menu)`
+#### `tray.setContextMenu(menu)`
 
 * `menu` Menu
 
 Sets the context menu for this icon.
 
-### `Tray.getBounds()` _macOS_ _Windows_
+#### `tray.getBounds()` _macOS_ _Windows_
 
 Returns the `bounds` of this tray icon as `Object`.