Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
let exportList;
ipc.answerRenderer('get-exports', () => exportList.getExports());
ipc.answerRenderer('export', options => exportList.addExport(options));
ipc.answerRenderer('cancel-export', createdAt => exportList.cancelExport(createdAt));
ipc.answerRenderer('open-export', createdAt => exportList.openExport(createdAt));
ipc.answerRenderer('export-snapshot', saveSnapshot);
ipc.on('drag-export', async (event, createdAt) => {
const exportItem = exportList.getExport(createdAt);
const file = exportItem && exportItem.data.filePath;
if (file && fs.existsSync(file)) {
event.sender.startDrag({
file,
icon: await getDragIcon(exportItem.imagePath)
});
}
});
const callExportsWindow = (channel, data) => {
const exportsWindow = getExportsWindow();
if (exportsWindow) {
// TODO(karaggeorge): Investigate why `ipc.callRenderer(exportsWindow, channel, data);` is not working here.
created(sessionId, sessionWindowId) {
this.sessionId = sessionId
this.sessionWindow = BrowserWindow.getAllWindows().find(browserWindow => {
return browserWindow.id === sessionWindowId
})
ipc.on(`pty-resize-${this.sessionId}`, this.handleResize.bind(this))
ipc.on(`pty-write-${this.sessionId}`, this.handleWrite.bind(this))
this.pty.onExit(() => {
this.sessionWindow.webContents.send(`pty-exit-${this.sessionId}`)
})
this.pty.onData(data => this.bufferData(data))
}
export default profileManager => {
const enableShortcuts = () => register(profileManager)
const disableShortcuts = () => globalShortcut.unregisterAll()
subscriptions.add(
profileManager.onDidChange('visor.keybinding', () => {
disableShortcuts()
enableShortcuts()
})
)
ipc.on('disable-shortcuts', disableShortcuts)
subscriptions.add(
new Disposable(() => ipc.removeListener('disable-shortcuts', disableShortcuts))
)
ipc.on('enable-shortcuts', enableShortcuts)
subscriptions.add(
new Disposable(() => ipc.removeListener('enable-shortcuts', enableShortcuts))
)
enableShortcuts()
}
export default profileManager => {
const enableShortcuts = () => register(profileManager)
const disableShortcuts = () => globalShortcut.unregisterAll()
subscriptions.add(
profileManager.onDidChange('visor.keybinding', () => {
disableShortcuts()
enableShortcuts()
})
)
ipc.on('disable-shortcuts', disableShortcuts)
subscriptions.add(
new Disposable(() => ipc.removeListener('disable-shortcuts', disableShortcuts))
)
ipc.on('enable-shortcuts', enableShortcuts)
subscriptions.add(
new Disposable(() => ipc.removeListener('enable-shortcuts', enableShortcuts))
)
enableShortcuts()
}