Use require('electron') in Electron's code
This commit is contained in:
parent
f9d7e7ce55
commit
1d1f911b09
71 changed files with 265 additions and 250 deletions
|
@ -1,5 +1,6 @@
|
|||
var app = require('app');
|
||||
var BrowserWindow = require('browser-window');
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
|
||||
var mainWindow = null;
|
||||
|
||||
|
|
|
@ -57,13 +57,17 @@
|
|||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var execPath = require('remote').process.execPath;
|
||||
const electron = require('electron');
|
||||
const remote = electron.remote;
|
||||
const shell = electron.shell;
|
||||
|
||||
var execPath = remote.process.execPath;
|
||||
var command = execPath + ' path-to-your-app';
|
||||
|
||||
document.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
if (e.target.tagName == 'A')
|
||||
require('shell').openExternal(e.target.href);
|
||||
shell.openExternal(e.target.href);
|
||||
return false;
|
||||
};
|
||||
document.ondragover = document.ondrop = function(e) {
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
var app = require('app');
|
||||
var dialog = require('dialog');
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const dialog = electron.dialog;
|
||||
const shell = electron.shell;
|
||||
const Menu = electron.Menu;
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var Menu = require('menu');
|
||||
var BrowserWindow = require('browser-window');
|
||||
|
||||
// Quit when all windows are closed and no other one is listening to this.
|
||||
app.on('window-all-closed', function() {
|
||||
|
@ -142,19 +144,19 @@ app.once('ready', function() {
|
|||
submenu: [
|
||||
{
|
||||
label: 'Learn More',
|
||||
click: function() { require('shell').openExternal('http://electron.atom.io') }
|
||||
click: function() { shell.openExternal('http://electron.atom.io') }
|
||||
},
|
||||
{
|
||||
label: 'Documentation',
|
||||
click: function() { require('shell').openExternal('https://github.com/atom/electron/tree/master/docs#readme') }
|
||||
click: function() { shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme') }
|
||||
},
|
||||
{
|
||||
label: 'Community Discussions',
|
||||
click: function() { require('shell').openExternal('https://discuss.atom.io/c/electron') }
|
||||
click: function() { shell.openExternal('https://discuss.atom.io/c/electron') }
|
||||
},
|
||||
{
|
||||
label: 'Search Issues',
|
||||
click: function() { require('shell').openExternal('https://github.com/atom/electron/issues') }
|
||||
click: function() { shell.openExternal('https://github.com/atom/electron/issues') }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -269,5 +271,5 @@ if (option.file && !option.webdriver) {
|
|||
console.log(helpMessage);
|
||||
process.exit(0);
|
||||
} else {
|
||||
require('./default_app.js');
|
||||
require('./default_app');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue