use standard-style javascript in nativeImage doc
This commit is contained in:
parent
9ca0fbaeb7
commit
9432cb9170
1 changed files with 7 additions and 7 deletions
|
@ -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])`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue