Stop using deprecated Electron API

This commit is contained in:
Yuya Ochiai
2015-11-20 18:04:20 +09:00
parent 9d7a8845cb
commit 07f42063e6
4 changed files with 9 additions and 9 deletions

View File

@@ -32,10 +32,10 @@ webView.addEventListener('page-title-set', function(e) {
// Open external link in default browser. // Open external link in default browser.
webView.addEventListener('new-window', function(e) { webView.addEventListener('new-window', function(e) {
var currentUrl = url.parse(webView.getUrl()); var currentURL = url.parse(webView.getURL());
var destUrl = url.parse(e.url); var destURL = url.parse(e.url);
// Open in browserWindow. for exmaple, attached files. // Open in browserWindow. for exmaple, attached files.
if (currentUrl.host === destUrl.host) { if (currentURL.host === destURL.host) {
window.open(e.url, 'Mattermost'); window.open(e.url, 'Mattermost');
} }
else { else {

View File

@@ -4,7 +4,7 @@ var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window. var BrowserWindow = require('browser-window'); // Module to create native browser window.
var Menu = require('menu'); var Menu = require('menu');
var Tray = require('tray'); var Tray = require('tray');
var ipc = require('ipc'); var ipc = require('ipcMain');
var appMenu = require('./menus/app'); var appMenu = require('./menus/app');
var client = null; var client = null;
@@ -56,10 +56,10 @@ app.on('ready', function() {
trayIcon.setToolTip(app.getName()); trayIcon.setToolTip(app.getName());
var tray_menu = require('./menus/tray').createDefault(); var tray_menu = require('./menus/tray').createDefault();
trayIcon.setContextMenu(tray_menu); trayIcon.setContextMenu(tray_menu);
trayIcon.on('clicked', function() { trayIcon.on('click', function() {
mainWindow.focus(); mainWindow.focus();
}); });
trayIcon.on('balloon-clicked', function() { trayIcon.on('balloon-click', function() {
mainWindow.focus(); mainWindow.focus();
}); });
ipc.on('notified', function(event, arg) { ipc.on('notified', function(event, arg) {
@@ -79,7 +79,7 @@ app.on('ready', function() {
}); });
// and load the index.html of the app. // and load the index.html of the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html'); mainWindow.loadURL('file://' + __dirname + '/index.html');
// Open the DevTools. // Open the DevTools.
// mainWindow.openDevTools(); // mainWindow.openDevTools();

View File

@@ -14,7 +14,7 @@ var createTemplate = function(mainWindow) {
}, { }, {
label: 'Settings', label: 'Settings',
click: function(item, focusedWindow) { click: function(item, focusedWindow) {
mainWindow.loadUrl('file://' + __dirname + '/../settings.html'); mainWindow.loadURL('file://' + __dirname + '/../settings.html');
} }
}, { }, {
label: 'Quit', label: 'Quit',

View File

@@ -1,6 +1,6 @@
'use strict'; 'use strict';
var ipc = require('ipc'); var ipc = require('ipcRenderer');
ipc.on('retrieveUnreadCount', function() { ipc.on('retrieveUnreadCount', function() {
var unreadCount = document.getElementsByClassName('unread-title').length; var unreadCount = document.getElementsByClassName('unread-title').length;