30 lines
503 B
JavaScript
30 lines
503 B
JavaScript
let electron = require('electron');
|
|
let allWindow = {};
|
|
|
|
function init(win){
|
|
let id = win.id;
|
|
allWindow[id] = win;
|
|
// win.webContents.openDevTools();
|
|
win.once('ready-to-show', () => {
|
|
// win.webContents.openDevTools();
|
|
win.webContents.send('init_win_id', id);
|
|
win.show()
|
|
});
|
|
return id;
|
|
}
|
|
|
|
function close(id){
|
|
delete allWindow[id];
|
|
}
|
|
|
|
|
|
function get(id){
|
|
return allWindow[id];
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
init: init,
|
|
get: get,
|
|
close: close
|
|
}; |