浏览代码

first commit

chuwanghui 8 年之前
当前提交
a7c77bc865
共有 11 个文件被更改,包括 3279 次插入0 次删除
  1. 1 0
      .gitignore
  2. 31 0
      .vscode/launch.json
  3. 39 0
      LICENSE.md
  4. 19 0
      README.md
  5. 1745 0
      package-lock.json
  6. 19 0
      resources/app/index.html
  7. 53 0
      resources/app/main.js
  8. 1279 0
      resources/app/package-lock.json
  9. 29 0
      resources/app/package.json
  10. 9 0
      resources/app/renderer.js
  11. 55 0
      resources/app/us.main.js

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+node_modules

+ 31 - 0
.vscode/launch.json

@@ -0,0 +1,31 @@
+{
+  "version": "0.2.0",
+  "configurations": [
+    {
+      "name": "Debug Main Process",
+      "type": "node",
+      "request": "launch",
+      "cwd": "${workspaceRoot}",
+      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
+      "windows": {
+        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
+      },
+      "program": "${workspaceRoot}/resources/app/us.main.js",
+      "protocol": "legacy"
+    },
+    {
+      "name": "Debug Renderer Process",
+      "type": "chrome",
+      "request": "launch",
+      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
+      "windows": {
+        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
+      },
+      "runtimeArgs": [
+        "${workspaceRoot}/resources/app/main.js",
+        "--remote-debugging-port=9222"
+      ],
+      "webRoot": "${workspaceRoot}"
+    }
+  ]
+}

文件差异内容过多而无法显示
+ 39 - 0
LICENSE.md


+ 19 - 0
README.md

@@ -0,0 +1,19 @@
+# electron-quick-start
+
+**Modified to debug in VS Code**
+
+## Instructions
+
+- `npm install`
+- Open it in VS Code
+- Install [Debugger for Chrome](https://marketplace.visualstudio.com/items/msjsdiag.debugger-for-chrome) if you haven't
+- (Windows) Go to `.vscode/launch.json` and modify `runtimeExecutable`
+- Run either "Debug Main Process" or "Debug Renderer Process" in Debug Viewlet
+
+## Commit that has the modification
+
+[22d85fe](https://github.com/octref/vscode-electron-debug/commit/22d85fe0d736b0842a7d3ad66b50c4097a8a4005)
+
+## License
+
+CC0, same as [electron/electron-quick-start](https://github.com/electron/electron-quick-start).

文件差异内容过多而无法显示
+ 1745 - 0
package-lock.json


+ 19 - 0
resources/app/index.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="UTF-8">
+    <title>Hello World!</title>
+  </head>
+  <body>
+    <h1>Hello World!</h1>
+    <!-- All of the Node.js APIs are available in this renderer process. -->
+    We are using node <script>document.write(process.versions.node)</script>,
+    Chromium <script>document.write(process.versions.chrome)</script>,
+    and Electron <script>document.write(process.versions.electron)</script>.
+  </body>
+
+  <script>
+    // You can also require other files to run in this process
+    require('./renderer.js')
+  </script>
+</html>

+ 53 - 0
resources/app/main.js

@@ -0,0 +1,53 @@
+const electron = require('electron')
+// Module to control application life.
+const app = electron.app
+// Module to create native browser window.
+const BrowserWindow = electron.BrowserWindow
+
+// Keep a global reference of the window object, if you don't, the window will
+// be closed automatically when the JavaScript object is garbage collected.
+let mainWindow
+
+function createWindow () {
+  // Create the browser window.
+  mainWindow = new BrowserWindow({width: 800, height: 600})
+
+  // and load the index.html of the app.
+  mainWindow.loadURL(`file://${__dirname}/index.html`)
+
+  // Open the DevTools.
+  // mainWindow.webContents.openDevTools()
+
+  // Emitted when the window is closed.
+  mainWindow.on('closed', function () {
+    // Dereference the window object, usually you would store windows
+    // in an array if your app supports multi windows, this is the time
+    // when you should delete the corresponding element.
+    mainWindow = null
+  })
+}
+
+// This method will be called when Electron has finished
+// initialization and is ready to create browser windows.
+// Some APIs can only be used after this event occurs.
+app.on('ready', createWindow)
+
+// Quit when all windows are closed.
+app.on('window-all-closed', function () {
+  // On OS X it is common for applications and their menu bar
+  // to stay active until the user quits explicitly with Cmd + Q
+  if (process.platform !== 'darwin') {
+    app.quit()
+  }
+})
+
+app.on('activate', function () {
+  // On OS X it's common to re-create a window in the app when the
+  // dock icon is clicked and there are no other windows open.
+  if (mainWindow === null) {
+    createWindow()
+  }
+})
+
+// In this file you can include the rest of your app's specific main process
+// code. You can also put them in separate files and require them here.

文件差异内容过多而无法显示
+ 1279 - 0
resources/app/package-lock.json


+ 29 - 0
resources/app/package.json

@@ -0,0 +1,29 @@
+{
+  "name": "electron-quick-start",
+  "version": "1.0.0",
+  "description": "A minimal Electron application",
+  "main": "us.main.js",
+  "scripts": {
+    "start": "electron ."
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/electron/electron-quick-start.git"
+  },
+  "keywords": [
+    "Electron",
+    "quick",
+    "start",
+    "tutorial"
+  ],
+  "author": "GitHub",
+  "license": "CC0-1.0",
+  "bugs": {
+    "url": "https://github.com/electron/electron-quick-start/issues"
+  },
+  "homepage": "https://github.com/electron/electron-quick-start#readme",
+  "devDependencies": {
+    "electron": "1.5.1"
+  },
+  "package":"electron-packager  ./ usestudioapp --platform=win32 --arch=x64 --out=./output --electron-version=1.4.13 --version 1.0.0 --overwrite"
+}

+ 9 - 0
resources/app/renderer.js

@@ -0,0 +1,9 @@
+// This file is required by the index.html file and will
+// be executed in the renderer process for that window.
+// All of the Node.js APIs are available in this process.
+
+console.log('hello world!')
+
+document.body.addEventListener('click', () => {
+  console.log('hello vscode!')
+})

+ 55 - 0
resources/app/us.main.js

@@ -0,0 +1,55 @@
+const electron = require('electron')
+// Module to control application life.
+const app = electron.app
+// Module to create native browser window.
+const BrowserWindow = electron.BrowserWindow
+
+// Keep a global reference of the window object, if you don't, the window will
+// be closed automatically when the JavaScript object is garbage collected.
+let mainWindow
+
+function createWindow () {
+  // Create the browser window.
+  mainWindow = new BrowserWindow({})
+  mainWindow.maximize()
+
+  // and load the index.html of the app.
+  //mainWindow.loadURL(`file://${__dirname}/index.html`)
+  mainWindow.loadURL(`http://www.1473.cn`)
+
+  // Open the DevTools.
+  // mainWindow.webContents.openDevTools()
+
+  // Emitted when the window is closed.
+  mainWindow.on('closed', function () {
+    // Dereference the window object, usually you would store windows
+    // in an array if your app supports multi windows, this is the time
+    // when you should delete the corresponding element.
+    mainWindow = null
+  })
+}
+
+// This method will be called when Electron has finished
+// initialization and is ready to create browser windows.
+// Some APIs can only be used after this event occurs.
+app.on('ready', createWindow)
+
+// Quit when all windows are closed.
+app.on('window-all-closed', function () {
+  // On OS X it is common for applications and their menu bar
+  // to stay active until the user quits explicitly with Cmd + Q
+  if (process.platform !== 'darwin') {
+    app.quit()
+  }
+})
+
+app.on('activate', function () {
+  // On OS X it's common to re-create a window in the app when the
+  // dock icon is clicked and there are no other windows open.
+  if (mainWindow === null) {
+    createWindow()
+  }
+})
+
+// In this file you can include the rest of your app's specific main process
+// code. You can also put them in separate files and require them here.