use standard-style javascript in nativeImage doc

This commit is contained in:
Zeke Sikelianos 2016-07-22 13:47:05 -07:00
parent 9ca0fbaeb7
commit 9432cb9170

View file

@ -9,15 +9,15 @@ For example, when creating a tray or setting a window's icon, you can pass an
image file path as a `String`: image file path as a `String`:
```javascript ```javascript
const appIcon = new Tray('/Users/somebody/images/icon.png'); const appIcon = new Tray('/Users/somebody/images/icon.png')
let win = new BrowserWindow({icon: '/Users/somebody/images/window.png'}); let win = new BrowserWindow({icon: '/Users/somebody/images/window.png'})
``` ```
Or read the image from the clipboard which returns a `nativeImage`: Or read the image from the clipboard which returns a `nativeImage`:
```javascript ```javascript
const image = clipboard.readImage(); const image = clipboard.readImage()
const appIcon = new Tray(image); const appIcon = new Tray(image)
``` ```
## Supported Formats ## Supported Formats
@ -55,7 +55,7 @@ images/
```javascript ```javascript
let appIcon = new Tray('/Users/somebody/images/icon.png'); let appIcon = new Tray('/Users/somebody/images/icon.png')
``` ```
Following suffixes for DPI are also supported: Following suffixes for DPI are also supported:
@ -105,8 +105,8 @@ Creates an empty `NativeImage` instance.
Creates a new `NativeImage` instance from a file located at `path`. Creates a new `NativeImage` instance from a file located at `path`.
```javascript ```javascript
const nativeImage = require('electron').nativeImage; const {nativeImage} = require('electron')
let image = nativeImage.createFromPath('/Users/somebody/images/icon.png'); let image = nativeImage.createFromPath('/Users/somebody/images/icon.png')
``` ```
### `nativeImage.createFromBuffer(buffer[, scaleFactor])` ### `nativeImage.createFromBuffer(buffer[, scaleFactor])`