@@ -18,7 +18,7 @@ the currently running operating system's native notification APIs to display it.
1818** Note:** Since this is an HTML5 API it is only available in the renderer process.
1919
2020``` javascript
21- var myNotification = new Notification (' Title' , {
21+ let myNotification = new Notification (' Title' , {
2222 body: ' Lorem Ipsum Dolor Sit Amet'
2323});
2424
@@ -117,8 +117,8 @@ const electron = require('electron');
117117const app = electron .app ;
118118const Menu = electron .Menu ;
119119
120- var dockMenu = Menu .buildFromTemplate ([
121- { label: ' New Window' , click : function () { console .log (' New Window' ); } },
120+ const dockMenu = Menu .buildFromTemplate ([
121+ { label: ' New Window' , click : () => { console .log (' New Window' ); } },
122122 { label: ' New Window with Settings' , submenu: [
123123 { label: ' Basic' },
124124 { label: ' Pro' }
@@ -209,24 +209,25 @@ You can use [BrowserWindow.setThumbarButtons][setthumbarbuttons] to set
209209thumbnail toolbar in your application:
210210
211211``` javascript
212- const BrowserWindow = require (' electron' ). BrowserWindow ;
212+ const { BrowserWindow } = require (' electron' );
213213const path = require (' path' );
214214
215- var win = new BrowserWindow ({
215+ let win = new BrowserWindow ({
216216 width: 800 ,
217217 height: 600
218218});
219+
219220win .setThumbarButtons ([
220221 {
221222 tooltip: " button1" ,
222223 icon: path .join (__dirname , ' button1.png' ),
223- click : function () { console .log (" button2 clicked" ); }
224+ click : () => { console .log (" button2 clicked" ); }
224225 },
225226 {
226227 tooltip: " button2" ,
227228 icon: path .join (__dirname , ' button2.png' ),
228229 flags: [' enabled' , ' dismissonclick' ],
229- click : function () { console .log (" button2 clicked." ); }
230+ click : () => { console .log (" button2 clicked." ); }
230231 }
231232]);
232233```
@@ -266,7 +267,7 @@ To set the progress bar for a Window, you can use the
266267[ BrowserWindow.setProgressBar] [ setprogressbar ] API:
267268
268269``` javascript
269- var window = new BrowserWindow ({... });
270+ let window = new BrowserWindow ({... });
270271window .setProgressBar (0.5 );
271272```
272273
@@ -293,7 +294,7 @@ To set the overlay icon for a window, you can use the
293294[ BrowserWindow.setOverlayIcon] [ setoverlayicon ] API:
294295
295296``` javascript
296- var window = new BrowserWindow ({... });
297+ let window = new BrowserWindow ({... });
297298window .setOverlayIcon (' path/to/overlay.png' , ' Description for overlay' );
298299```
299300
@@ -315,7 +316,7 @@ To set the represented file of window, you can use the
315316[ BrowserWindow.setDocumentEdited] [ setdocumentedited ] APIs:
316317
317318``` javascript
318- var window = new BrowserWindow ({... });
319+ let window = new BrowserWindow ({... });
319320window .setRepresentedFilename (' /etc/passwd' );
320321window .setDocumentEdited (true );
321322```
0 commit comments