File tree Expand file tree Collapse file tree
getting-started-with-electron-1.0 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Getting Started with Electron 1.x
2+
3+ > [ https://youtu.be/jKzBJAowmGg ] ( https://youtu.be/jKzBJAowmGg )
4+
5+ * Install [ Node.js] ( https://nodejs.org/ ) .
6+ * Install dependencies: ` npm install `
7+ * Then run ` npm start ` to open the desktop application.
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > Document</ title >
6+ </ head >
7+ < body >
8+ I'm bear a html file!
9+ </ body >
10+ </ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > Document</ title >
6+ </ head >
7+ < body >
8+ < h1 > Grrr!</ h1 >
9+ < script > require ( './index.js' ) </ script >
10+ </ body >
11+ </ html >
Original file line number Diff line number Diff line change 1+
2+ const remote = require ( 'electron' ) . remote
3+ const main = remote . require ( './main.js' )
4+
5+ var button = document . createElement ( 'button' )
6+ button . textContent = 'Open Window'
7+ button . addEventListener ( 'click' , ( ) => {
8+ main . openWindow ( )
9+ } , false )
10+ document . body . appendChild ( button )
Original file line number Diff line number Diff line change 1+ const electron = require ( 'electron' )
2+ const { app, BrowserWindow} = electron
3+
4+ app . on ( 'ready' , ( ) => {
5+ let win = new BrowserWindow ( { width :800 , height : 600 } )
6+ win . loadURL ( `file://${ __dirname } /index.html` )
7+ win . webContents . openDevTools ( )
8+ } )
9+
10+ exports . openWindow = ( ) => {
11+ let win = new BrowserWindow ( { width :400 , height : 200 } )
12+ win . loadURL ( `file://${ __dirname } /bear.html` )
13+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " getting-started-with-electron-1.0" ,
3+ "version" : " 0.1.0" ,
4+ "description" : " " ,
5+ "main" : " main.js" ,
6+ "scripts" : {
7+ "start" : " electron main.js"
8+ },
9+ "author" : " Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)" ,
10+ "license" : " MIT" ,
11+ "devDependencies" : {
12+ "electron-prebuilt" : " ^1.2.5"
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments