-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
21 lines (19 loc) · 1.06 KB
/
Copy pathpreload.js
File metadata and controls
21 lines (19 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('termAPI', {
create: (opts) => ipcRenderer.invoke('pty-create', opts),
write: (id, data) => ipcRenderer.send('pty-write', { id, data }),
resize: (id, cols, rows) => ipcRenderer.send('pty-resize', { id, cols, rows }),
kill: (id) => ipcRenderer.send('pty-kill', { id }),
onData: (cb) => ipcRenderer.on('pty-data', (_e, msg) => cb(msg)),
onExit: (cb) => ipcRenderer.on('pty-exit', (_e, msg) => cb(msg)),
loadStartup: () => ipcRenderer.invoke('startup-load'),
loadState: () => ipcRenderer.invoke('state-load'),
saveState: (state) => ipcRenderer.send('state-save', state),
onUpdate: (cb) => ipcRenderer.on('update-available', (_e, msg) => cb(msg)),
onUpdateProgress: (cb) => ipcRenderer.on('update-progress', (_e, msg) => cb(msg)),
onUpdateError: (cb) => ipcRenderer.on('update-error', (_e, msg) => cb(msg)),
installUpdate: () => ipcRenderer.send('update-install'),
openUrl: (url) => ipcRenderer.send('open-url', url),
platform: process.platform
});