1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

test 0.2.0

This commit is contained in:
Rokt33r
2015-08-04 16:23:25 +09:00
parent 1bebb66165
commit 932997259f
5 changed files with 81 additions and 8 deletions

74
main.js
View File

@@ -1,6 +1,7 @@
var app = require('app')
var BrowserWindow = require('browser-window')
var Menu = require('menu')
var MenuItem = require('menu-item')
var Tray = require('tray')
require('crash-reporter').start()
@@ -10,11 +11,54 @@ var appIcon = null
var menu = null
var popUpWindow = null
var update = null
// app.on('window-all-closed', function () {
// if (process.platform !== 'darwin') app.quit()
// })
var version = '0.2.0'
var nn = require('node-notifier')
var autoUpdater = require('auto-updater')
autoUpdater
.on('error', function (err, message) {
nn.notify({
title: 'Boost Update Center Ver. ' + version,
message: message
})
})
.on('checking-for-update', function () {
nn.notify({
title: 'Boost Update Center Ver. ' + version,
message: 'Hello from Main processor, Mr. User!'
})
})
.on('update-available', function () {
nn.notify({
title: 'Boost Update Center Ver. ' + version,
message: 'Update is available. Starting download latest build...'
})
})
.on('update-not-available', function () {
nn.notify({
title: 'Boost Update Center Ver. ' + version,
message: 'Latest Build :D'
})
})
.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
nn.notify({
title: 'Boost Update Center Ver. ' + version,
message: 'Ready to Update: ' + releaseName
})
update = quitAndUpdate
})
app.on('ready', function () {
console.log('Version ' + version)
autoUpdater.setFeedUrl('http://localhost:8000/testcat/test/latest?version=' + version)
autoUpdater.checkForUpdates()
// menu start
var template = require('./modules/menu-template')
@@ -24,12 +68,32 @@ app.on('ready', function () {
// menu end
appIcon = new Tray(__dirname + '/tray-icon.png')
appIcon.setToolTip('Codexen')
appIcon.on('clicked', function () {
if (mainWindow == null) {
makeNewMainWindow()
var trayMenu = new Menu()
trayMenu.append(new MenuItem({
label: 'Open main window',
click: function () {
if (mainWindow == null) {
makeNewMainWindow()
}
mainWindow.show()
}
mainWindow.show()
})
}))
trayMenu.append(new MenuItem({
label: 'Update App',
click: function () {
if (update != null) {
update()
}
}
}))
trayMenu.append(new MenuItem({
label: 'Quit',
click: function () {
app.quit()
}
}))
appIcon.setContextMenu(trayMenu)
makeNewMainWindow()