| 
									
										
										
										
											2013-04-18 15:09:53 +08:00
										 |  |  | <html> | 
					
						
							|  |  |  | <head> | 
					
						
							| 
									
										
										
										
											2015-04-08 10:16:10 -07:00
										 |  |  |   <title>Electron</title> | 
					
						
							| 
									
										
										
										
											2014-05-05 16:02:52 +08:00
										 |  |  |   <style> | 
					
						
							|  |  |  |     body { | 
					
						
							| 
									
										
										
										
											2016-02-17 09:51:24 -08:00
										 |  |  |       color: #45828E; | 
					
						
							|  |  |  |       background-color: #A5ECFA; | 
					
						
							|  |  |  |       font-family: 'Helvetica Neue', 'Open Sans', Helvetica, Arial, sans-serif; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:02:52 +08:00
										 |  |  |       padding: 30px; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     h2 { | 
					
						
							|  |  |  |       font-weight: 400; | 
					
						
							|  |  |  |       line-height: 1.1; | 
					
						
							|  |  |  |       letter-spacing: -0.015em; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     a { | 
					
						
							| 
									
										
										
										
											2016-02-17 09:51:24 -08:00
										 |  |  |       color: #39AEC6; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:02:52 +08:00
										 |  |  |       text-decoration: none; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-02-17 09:51:24 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-05 16:02:52 +08:00
										 |  |  |     a:hover { | 
					
						
							|  |  |  |       text-decoration: underline; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pre, code { | 
					
						
							|  |  |  |       font-family: "Menlo","Lucida Console",monospace; | 
					
						
							|  |  |  |       border: 1px solid #ddd; | 
					
						
							| 
									
										
										
										
											2016-02-17 09:51:24 -08:00
										 |  |  |       background-color: #076274; | 
					
						
							|  |  |  |       color: #C5F3FC; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:02:52 +08:00
										 |  |  |       border-radius: 3px; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pre { | 
					
						
							|  |  |  |       white-space: pre-wrap; | 
					
						
							|  |  |  |       font-size: 13px; | 
					
						
							|  |  |  |       line-height: 19px; | 
					
						
							|  |  |  |       overflow: auto; | 
					
						
							|  |  |  |       padding: 6px 10px; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-05-05 16:30:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-17 09:51:24 -08:00
										 |  |  |     code { | 
					
						
							|  |  |  |       padding: 1px 4px 1px 4px; | 
					
						
							|  |  |  |       font-size: 13px; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-05 16:30:37 +08:00
										 |  |  |     #holder { | 
					
						
							|  |  |  |       border: 4px dashed #ccc; | 
					
						
							|  |  |  |       margin: 0 auto; | 
					
						
							|  |  |  |       height: 300px; | 
					
						
							|  |  |  |       color: #ccc; | 
					
						
							|  |  |  |       font-size: 40px; | 
					
						
							|  |  |  |       line-height: 300px; | 
					
						
							|  |  |  |       text-align: center; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:46:25 +08:00
										 |  |  |       -webkit-user-select: none; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:30:37 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-02-17 09:51:24 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-05 16:30:37 +08:00
										 |  |  |     #holder.hover { | 
					
						
							|  |  |  |       border: 4px dashed #999; | 
					
						
							|  |  |  |       color: #eee; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-05-05 16:02:52 +08:00
										 |  |  |   </style> | 
					
						
							| 
									
										
										
										
											2013-04-18 15:09:53 +08:00
										 |  |  | </head> | 
					
						
							|  |  |  | <body> | 
					
						
							| 
									
										
										
										
											2014-05-05 15:45:50 +08:00
										 |  |  |   <script> | 
					
						
							| 
									
										
										
										
											2015-11-12 18:28:04 +08:00
										 |  |  |     const electron = require('electron'); | 
					
						
							|  |  |  |     const remote = electron.remote; | 
					
						
							|  |  |  |     const shell = electron.shell; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     var execPath = remote.process.execPath; | 
					
						
							| 
									
										
										
										
											2014-05-05 15:45:50 +08:00
										 |  |  |     var command = execPath + ' path-to-your-app'; | 
					
						
							| 
									
										
										
										
											2013-05-14 21:39:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-05 16:46:25 +08:00
										 |  |  |     document.onclick = function(e) { | 
					
						
							|  |  |  |       e.preventDefault(); | 
					
						
							|  |  |  |       if (e.target.tagName == 'A') | 
					
						
							| 
									
										
										
										
											2015-11-12 18:28:04 +08:00
										 |  |  |         shell.openExternal(e.target.href); | 
					
						
							| 
									
										
										
										
											2014-05-05 16:46:25 +08:00
										 |  |  |       return false; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:30:37 +08:00
										 |  |  |     document.ondragover = document.ondrop = function(e) { | 
					
						
							|  |  |  |       e.preventDefault(); | 
					
						
							|  |  |  |       return false; | 
					
						
							| 
									
										
										
										
											2014-05-05 16:46:25 +08:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2013-05-14 21:39:00 +08:00
										 |  |  |   </script> | 
					
						
							| 
									
										
										
										
											2014-05-05 15:45:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-21 02:26:59 +02:00
										 |  |  |   <h2> | 
					
						
							|  |  |  |     <script> | 
					
						
							|  |  |  |       document.write(`Welcome to Electron (v${process.versions.electron})`) | 
					
						
							|  |  |  |     </script> | 
					
						
							|  |  |  |   </h2> | 
					
						
							| 
									
										
										
										
											2014-05-05 15:45:50 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   <p> | 
					
						
							| 
									
										
										
										
											2015-04-14 15:55:41 +08:00
										 |  |  |   To run your app with Electron, execute the following command under your | 
					
						
							| 
									
										
										
										
											2014-05-05 15:45:50 +08:00
										 |  |  |   Console (or Terminal): | 
					
						
							|  |  |  |   </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <script>document.write('<pre>' + command + '</pre>')</script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <p> | 
					
						
							| 
									
										
										
										
											2015-04-14 15:55:41 +08:00
										 |  |  |   The <code>path-to-your-app</code> should be the path to your own Electron | 
					
						
							| 
									
										
										
										
											2015-11-21 02:26:59 +02:00
										 |  |  |   app, you can read the | 
					
						
							|  |  |  |   <script> | 
					
						
							|  |  |  |     document.write( | 
					
						
							|  |  |  |       `<a href='https://github.com/atom/electron/blob/v${process.versions.electron}/docs/tutorial/quick-start.md'>quick start</a>` | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   </script> | 
					
						
							|  |  |  |   guide in Electron's | 
					
						
							|  |  |  |   <script> | 
					
						
							|  |  |  |     document.write( | 
					
						
							|  |  |  |       `<a href='https://github.com/atom/electron/tree/v${process.versions.electron}/docs#readme'>docs</a>` | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   </script> | 
					
						
							| 
									
										
										
										
											2014-05-05 16:46:25 +08:00
										 |  |  |   on how to write one. | 
					
						
							| 
									
										
										
										
											2014-05-05 15:45:50 +08:00
										 |  |  |   </p> | 
					
						
							| 
									
										
										
										
											2014-05-05 16:30:37 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   <p> | 
					
						
							|  |  |  |   Or you can just drag your app here to run it: | 
					
						
							|  |  |  |   </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <div id="holder"> | 
					
						
							|  |  |  |     Drag your app here to run it | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <script> | 
					
						
							|  |  |  |     var holder = document.getElementById('holder'); | 
					
						
							|  |  |  |     holder.ondragover = function () { | 
					
						
							|  |  |  |       this.className = 'hover'; | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     holder.ondragleave = holder.ondragend = function () { | 
					
						
							|  |  |  |       this.className = ''; | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     holder.ondrop = function (e) { | 
					
						
							|  |  |  |       this.className = ''; | 
					
						
							|  |  |  |       e.preventDefault(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       var file = e.dataTransfer.files[0]; | 
					
						
							|  |  |  |       require('child_process').execFile(execPath, [file.path], { | 
					
						
							|  |  |  |         detached: true, stdio: 'ignore' | 
					
						
							|  |  |  |       }).unref(); | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   </script> | 
					
						
							| 
									
										
										
										
											2013-04-18 15:09:53 +08:00
										 |  |  | </body> | 
					
						
							|  |  |  | </html> |