mirror of
https://github.com/nuintun/command-manager.git
synced 2025-10-20 18:31:21 +08:00
update files
This commit is contained in:
39
static/js/components/window-control/index.js
Normal file
39
static/js/components/window-control/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user