Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit dc70e45

Browse files
committed
add hide endpoint and event handler
1 parent 8656432 commit dc70e45

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

dist/server/api/window.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ router.post('/close', (req, res) => {
3636
}
3737
return res.sendStatus(200);
3838
});
39+
router.post('/hide', (req, res) => {
40+
const { id } = req.body;
41+
if (state_1.default.windows[id]) {
42+
state_1.default.windows[id].hide();
43+
}
44+
return res.sendStatus(200);
45+
});
3946
router.get('/current', (req, res) => {
4047
const currentWindow = Object.values(state_1.default.windows).find(window => window.id === electron_1.BrowserWindow.getFocusedWindow().id);
4148
const id = Object.keys(state_1.default.windows).find(key => state_1.default.windows[key] === currentWindow);
@@ -148,6 +155,12 @@ router.post('/open', (req, res) => {
148155
payload: [id]
149156
});
150157
});
158+
window.on('hide', (evt) => {
159+
(0, utils_1.notifyLaravel)('events', {
160+
event: 'Native\\Laravel\\Events\\Windows\\WindowHidden',
161+
payload: [id]
162+
});
163+
});
151164
url += (url.indexOf('?') === -1 ? '?' : '&') + '_windowId=' + id;
152165
window.loadURL(url);
153166
window.webContents.on('did-finish-load', () => {

0 commit comments

Comments
 (0)