-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (23 loc) · 729 Bytes
/
index.js
File metadata and controls
29 lines (23 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { join } = require("path");
const { getAbsoluteFSPath } = require("swagger-ui-dist");
const { app, BrowserWindow } = require("electron");
const debug = require("debug")("swagger-ui-electron");
const swaggerUiIndex = join(getAbsoluteFSPath(), "index.html");
debug(`Serving Swagger UI from ${swaggerUiIndex}`);
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
});
win.loadFile(swaggerUiIndex);
};
app.whenReady().then(() => {
debug("Creating Window");
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit();
});