Я пытался научиться разрабатывать приложение для настольных компьютеров с помощью Electron. я обнаружил, что руководство: http://www.toptal.com/javascript/electron-cross-platform-desktop-apps-easyElectron Desktop APP
но многое изменилось ('ИСП' Теперь модуль является устаревшим, например) Сейчас:
Вот мой код
app.js
var app = require('app'),
ipc = require('electron').ipcMain,
BrowserWindow = require('browser-window');
var mainWindow = null,
insertWindow = null;
function createInsertWindow() {
insertWindow = new BrowserWindow({
width: 640,
height: 480,
show: false
});
insertWindow.loadURL('file://' + __dirname + '/windows/insert/insert.html');
insertWindow.on('closed',function() {
insertWindow = null;
});
insertWindow.show();
}
app.on('ready', function() {
mainWindow = new BrowserWindow({
width: 1024,
height: 768
});
mainWindow.loadURL('file://' + __dirname + '/windows/main/main.html');
mainWindow.openDevTools();
ipc.on('toggle-insert-view', function() {
if(! insertWindow) {
createInsertWindow();
} else {
return (insertWindow.isVisible()) ? insertWindow.hide() : insertWindow.show();
}
});
});
main.html
<!DOCTYPE html>
<html>
<head>
<script src="../../bower_components/angular/angular.min.js"></script>
<script src="./main.view.js"></script>
<meta charset="utf-8">
<title>Electron Desktop App</title>
</head>
<body>
<h1>EDA</h1>
<div ng-controller="MainCtrl as vm">
<button toggle-insert-view class="mdl-button">
add
</button>
</div>
</body>
</html>
main.view.js var ipcRenderer = require ('электрон'). IpcRenderer;
angular
.module('Utils', [])
.directive('toggleInsertView', function() {
return function(scope, el) {
el.bind('click', function(e) {
e.preventDefault();
ipcRenderer.send('toggle-insert-view');
});
};
});
Когда основные окна отображаются я нажмите на кнопку «Добавить» & изменения & ничего.
TNX я постараюсь как можно скорее –