File size: 640 Bytes
0e0fe0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { contextBridge } = require('electron');

contextBridge.exposeInMainWorld('api', {
  getApps: async () => {
    const response = await fetch('/api/apps');
    return response.json();
  },
  launchApp: async (appId) => {
    const response = await fetch(`/api/apps/${appId}/launch`, { method: 'POST' });
    return response.json();
  },
  stopApp: async (appId) => {
    const response = await fetch(`/api/apps/${appId}/stop`, { method: 'POST' });
    return response.json();
  },
  getAppStatus: async (appId) => {
    const response = await fetch(`/api/apps/${appId}/status`);
    return response.json();
  }
});