Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
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
HuangJunbo
antSword
Commits
0ba1db98
Commit
0ba1db98
authored
Jun 19, 2016
by
antoor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the update mode
更改程序更新方式
parent
8f3a41aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
38 deletions
+10
-38
app.js
app.js
+1
-1
menubar.js
modules/menubar.js
+0
-9
update.js
modules/update.js
+9
-28
No files found.
app.js
View file @
0ba1db98
...
...
@@ -62,7 +62,7 @@ app
electron
.
Logger
=
require
(
'./modules/logger'
)(
mainWindow
);
// 初始化模块
[
'menubar'
,
'request'
,
'database'
,
'cache'
,
'plugStore'
].
map
((
_
)
=>
{
[
'menubar'
,
'request'
,
'database'
,
'cache'
,
'
update'
,
'
plugStore'
].
map
((
_
)
=>
{
new
(
require
(
`./modules/
${
_
}
`
)
)(
electron
,
app
,
mainWindow
);
});
});
modules/menubar.js
View file @
0ba1db98
...
...
@@ -4,8 +4,6 @@
'use strict'
;
const
Update
=
require
(
'./update'
);
class
Menubar
{
constructor
(
electron
,
app
,
mainWindow
)
{
...
...
@@ -52,13 +50,6 @@ class Menubar {
click
:
event
.
sender
.
send
.
bind
(
event
.
sender
,
'menubar'
,
'settings-aproxy'
)
},
{
type
:
'separator'
},
{
label
:
LANG
[
'main'
][
'update'
],
enabled
:
false
,
accelerator
:
'Shift+CmdOrCtrl+U'
,
click
:
()
=>
{
new
Update
();
}
},
{
label
:
LANG
[
'main'
][
'settings'
],
accelerator
:
'Shift+CmdOrCtrl+S'
,
...
...
modules/update.js
View file @
0ba1db98
/**
* 中国蚁剑::更新程序
* 开写: 2016/05/31
* 更新: 2016/06/19
* 说明: 从2.0.0起,取消在线更新程序的方式,改为程序启动一分钟后,检测github->release最新的版本更新信息,然后提示手动更新
*/
const
config
=
require
(
'./config'
);
const
electron
=
require
(
'electron'
);
const
BrowserWindow
=
electron
.
BrowserWindow
;
class
Update
{
constructor
()
{
this
.
l
istenHandler
(
);
this
.
openWindow
(
);
constructor
(
electron
)
{
this
.
l
ogger
=
new
electron
.
Logger
(
'Update'
);
setTimeout
(
this
.
checkUpdate
.
bind
(
this
),
1000
*
60
);
}
/**
* 事件监听器
* 检查更新
* 如果有更新,则以通知的方式提示用户手动更新,用户点击跳转到更新页面
* @return {[type]} [description]
*/
listenHandler
()
{
electron
.
ipcMain
.
on
(
'update-getVersion'
,
(
event
)
=>
{
event
.
returnValue
=
config
.
package
[
'version'
]
})
}
/**
* 打开更新窗口
* @return {[type]} [description]
*/
openWindow
()
{
let
win
=
new
BrowserWindow
({
width
:
400
,
height
:
250
,
// height: 180,
// resizable: false,
minimizable
:
false
,
maximizable
:
false
});
win
.
loadURL
(
'ant-views://update.html'
);
win
.
webContents
.
openDevTools
();
checkUpdate
()
{
this
.
logger
.
debug
(
'checkUpdate..'
);
}
}
...
...
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