Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
netdisc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rocosen
netdisc
Commits
c0ae1dcd
Commit
c0ae1dcd
authored
Nov 24, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update main.ts
parent
75c3308a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
main.ts
src/main/main.ts
+19
-2
No files found.
src/main/main.ts
View file @
c0ae1dcd
...
...
@@ -15,6 +15,8 @@ import { autoUpdater } from 'electron-updater';
import
log
from
'electron-log'
;
import
MenuBuilder
from
'./menu'
;
import
{
resolveHtmlPath
}
from
'./util'
;
const
{
resolve
}
=
require
(
'path'
);
class
AppUpdater
{
constructor
()
{
log
.
transports
.
file
.
level
=
'info'
;
...
...
@@ -26,9 +28,24 @@ class AppUpdater {
let
mainWindow
:
BrowserWindow
|
null
=
null
;
let
win
:
BrowserWindow
|
null
=
null
;
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
function
urls
(
per
:
any
)
{
let
opts
=
require
(
'url'
).
format
({
protocol
:
'file:'
,
slashes
:
true
,
pathname
:
resolve
(
__dirname
,
'assets'
,
'index.html'
),
})
// win.resize(size2Width(), size2Height())
if
(
isDev
)
{
opts
=
`http://localhost:1212`
}
return
opts
+
per
}
const
winURL
=
process
.
env
.
NODE_ENV
===
'development'
?
`http://localhost:1212`
:
`file://
${
__dirname
}
/index.html`
:
`file://
${
__dirname
}
/
assets/
index.html`
ipcMain
.
on
(
'resize-site'
,
(
event
)
=>
{
if
(
win
)
{
...
...
@@ -53,7 +70,7 @@ ipcMain.on('createNewWindow', () => {
// parent: win, //win是主窗口
});
// win.loadURL(path.join('file:', __dirname, 'new.html')); //new.html是新开窗口的渲染进程
win
.
loadURL
(
winURL
+
"#/site"
);
win
.
loadURL
(
urls
(
'#/site'
)
);
// win.loadFile(path.join(__dirname));
// win.loadFile('./index.html', {
// hash: 'site',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment