Witam wszystkich mam problem z moim programem w node.js otóż kiedy próbuje stworzyć przycisk aby minimalizował okno nie wykonuje tego. Kiedy tą samą operację robiłem pół roku temu wszystko działało :/
index.js
'use strict';
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
var mainWindow = null;
app.on('window-all-closed', function() {
app.quit();
});
app.on('ready', function() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
frame: false
});
mainWindow.loadURL('file://' + __dirname + '/mainWindow.html');
mainWindow.webContents.openDevTools();
mainWindow.on('closed', function() {
mainWindow = null;
});
});
mainWindow.js
const remote = require('electron').remote;
const BrowserWindow = remote.BrowserWindow;
const $ = require('jquery');
var mainWindow = remote.getCurrentWindow();
$(document).ready(function() {
$('paper-icon-button.close').on('click', function() {
mainWindow.close();
});
$('paper-icon-button.minimize').on('click', function() {
mainWindow.minimize();
});
});
mainWindow.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World!</title>
<link href="bower_components/paper-toolbar/paper-toolbar.html" rel="import">
<link href="bower_components/paper-icon-button/paper-icon-button.html" rel="import">
<link href="bower_components/iron-icons/iron-icons.html" rel="import">
<link rel="stylesheet" type="text/css" href="styles/style.css" />
<script src='mainWindow.js'></script>
</head>
<body>
<paper-toolbar class="mainToolbar">
<paper-icon-button icon="menu"></paper-icon-button>
<span class="title">Test</span>
<paper-icon-button class="minimize" icon="remove"></paper-icon-button>
<paper-icon-button class="close" icon="close"></paper-icon-button>
</paper-toolbar>
</body>
</html>