Atom |
Slack |
VSCode |
Docker |
WordPress |
Sencha |
{
xtype: 'button',
handler: 'onMinimize',
cls: 'top-window-action',
iconCls: 'x-fa fa-minus'
},{
xtype: 'button',
handler: 'onPutOnTray',
cls: 'top-window-action',
iconCls: 'x-fa fa-eye-slash'
}
MainController.js
onMinimize: function() {
require("electron")
.remote.BrowserWindow.getFocusedWindow().minimize();
},
onPutOnTray: function() {
var ipc = require('electron').ipcRenderer;
ipc.send('put-in-tray');
}
global.processSensor = require('./sensors/process');
global.ramSensor = require('./sensors/ram');
global.cpuSensor = require('./sensors/cpu');
MainController.js
var processSensor = require('electron').remote.getGlobal('processSensor');
var ramSensor = require('electron').remote.getGlobal('ramSensor');
var cpuSensor = require('electron').remote.getGlobal('cpuSensor');
...
processSensor.poll();
ramSensor.poll();
cpuSensor.poll();
...
var processesData = processSensor.currentValue;
var ram = ramSensor.currentValue;
var cpu = cpuSensor.currentValue;
...
this.getStore('processes').loadData(processesData);
this.addRamValue(ram);
this.addCpuValue(cpu);