mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-07 03:14:07 +08:00
40 lines
845 B
JavaScript
40 lines
845 B
JavaScript
/**
|
|
* Created by nuintun on 2015/11/19.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
var ipc = require('ipc-renderer');
|
|
var Vue = require('../../vue/vue');
|
|
|
|
module.exports = Vue.component('window-control', {
|
|
data: function (){
|
|
return {
|
|
isMaximized: false
|
|
}
|
|
},
|
|
template: fs.readFileSync(path.join(__dirname, 'window-control.html')).toString(),
|
|
methods: {
|
|
tray: function (){
|
|
ipc.send('window', 'tray');
|
|
},
|
|
close: function (){
|
|
ipc.send('window', 'close');
|
|
},
|
|
maximize: function (){
|
|
ipc.send('window', this.isMaximized ? 'unmaximize' : 'maximize');
|
|
}
|
|
},
|
|
created: function (){
|
|
var context = this;
|
|
|
|
ipc.on('is-maximized', function (event, maximized){
|
|
context.isMaximized = maximized;
|
|
});
|
|
|
|
ipc.send('window', 'is-maximized');
|
|
}
|
|
});
|