mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-03 23:06:49 +01:00
debt - reduce usage of electron remote module
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const remote = require('electron').remote;
|
||||
const ipc = require('electron').ipcRenderer;
|
||||
|
||||
function assign(destination, source) {
|
||||
return Object.keys(source)
|
||||
@@ -97,9 +97,9 @@ function main() {
|
||||
window.addEventListener('keydown', function (e) {
|
||||
const key = extractKey(e);
|
||||
if (key === TOGGLE_DEV_TOOLS_KB) {
|
||||
remote.getCurrentWebContents().toggleDevTools();
|
||||
ipc.send('vscode:toggleDevTools');
|
||||
} else if (key === RELOAD_KB) {
|
||||
remote.getCurrentWindow().reload();
|
||||
ipc.send('vscode:reloadWindow');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!./media/issueReporter';
|
||||
import { shell, ipcRenderer, webFrame, remote, clipboard } from 'electron';
|
||||
import { shell, ipcRenderer, webFrame, clipboard } from 'electron';
|
||||
import { localize } from 'vs/nls';
|
||||
import { $ } from 'vs/base/browser/dom';
|
||||
import * as collections from 'vs/base/common/collections';
|
||||
@@ -91,7 +91,7 @@ export class IssueReporter extends Disposable {
|
||||
|
||||
this.previewButton = new Button(document.getElementById('issue-reporter'));
|
||||
|
||||
ipcRenderer.on('issuePerformanceInfoResponse', (event, info) => {
|
||||
ipcRenderer.on('vscode:issuePerformanceInfoResponse', (event, info) => {
|
||||
this.logService.trace('issueReporter: Received performance data');
|
||||
this.issueReporterModel.update(info);
|
||||
this.receivedPerformanceInfo = true;
|
||||
@@ -102,7 +102,7 @@ export class IssueReporter extends Disposable {
|
||||
this.updatePreviewButtonState();
|
||||
});
|
||||
|
||||
ipcRenderer.on('issueSystemInfoResponse', (event, info) => {
|
||||
ipcRenderer.on('vscode:issueSystemInfoResponse', (event, info) => {
|
||||
this.logService.trace('issueReporter: Received system data');
|
||||
this.issueReporterModel.update({ systemInfo: info });
|
||||
this.receivedSystemInfo = true;
|
||||
@@ -111,9 +111,9 @@ export class IssueReporter extends Disposable {
|
||||
this.updatePreviewButtonState();
|
||||
});
|
||||
|
||||
ipcRenderer.send('issueSystemInfoRequest');
|
||||
ipcRenderer.send('vscode:issueSystemInfoRequest');
|
||||
if (configuration.data.issueType === IssueType.PerformanceIssue) {
|
||||
ipcRenderer.send('issuePerformanceInfoRequest');
|
||||
ipcRenderer.send('vscode:issuePerformanceInfoRequest');
|
||||
}
|
||||
this.logService.trace('issueReporter: Sent data requests');
|
||||
|
||||
@@ -308,7 +308,7 @@ export class IssueReporter extends Disposable {
|
||||
const issueType = parseInt((<HTMLInputElement>event.target).value);
|
||||
this.issueReporterModel.update({ issueType: issueType });
|
||||
if (issueType === IssueType.PerformanceIssue && !this.receivedPerformanceInfo) {
|
||||
ipcRenderer.send('issuePerformanceInfoRequest');
|
||||
ipcRenderer.send('vscode:issuePerformanceInfoRequest');
|
||||
}
|
||||
this.updatePreviewButtonState();
|
||||
this.render();
|
||||
@@ -384,14 +384,14 @@ export class IssueReporter extends Disposable {
|
||||
this.previewButton.onDidClick(() => this.createIssue());
|
||||
|
||||
this.addEventListener('disableExtensions', 'click', () => {
|
||||
ipcRenderer.send('workbenchCommand', 'workbench.action.reloadWindowWithExtensionsDisabled');
|
||||
ipcRenderer.send('vscode:workbenchCommand', 'workbench.action.reloadWindowWithExtensionsDisabled');
|
||||
});
|
||||
|
||||
this.addEventListener('disableExtensions', 'keydown', (e: KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
if (e.keyCode === 13 || e.keyCode === 32) {
|
||||
ipcRenderer.send('workbenchCommand', 'workbench.extensions.action.disableAll');
|
||||
ipcRenderer.send('workbenchCommand', 'workbench.action.reloadWindow');
|
||||
ipcRenderer.send('vscode:workbenchCommand', 'workbench.extensions.action.disableAll');
|
||||
ipcRenderer.send('vscode:workbenchCommand', 'workbench.action.reloadWindow');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -400,7 +400,7 @@ export class IssueReporter extends Disposable {
|
||||
// Cmd/Ctrl+Enter previews issue and closes window
|
||||
if (cmdOrCtrlKey && e.keyCode === 13) {
|
||||
if (this.createIssue()) {
|
||||
remote.getCurrentWindow().close();
|
||||
ipcRenderer.send('vscode:closeIssueReporter');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const remote = require('electron').remote;
|
||||
const ipc = require('electron').ipcRenderer;
|
||||
|
||||
function assign(destination, source) {
|
||||
return Object.keys(source)
|
||||
@@ -141,9 +141,9 @@ function main() {
|
||||
window.addEventListener('keydown', function (e) {
|
||||
const key = extractKey(e);
|
||||
if (key === TOGGLE_DEV_TOOLS_KB) {
|
||||
remote.getCurrentWebContents().toggleDevTools();
|
||||
ipc.send('vscode:toggleDevTools');
|
||||
} else if (key === RELOAD_KB) {
|
||||
remote.getCurrentWindow().reload();
|
||||
ipc.send('vscode:reloadWindow');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ export function startup(data: ProcessExplorerData): void {
|
||||
applyZoom(data.zoomLevel);
|
||||
|
||||
// Map window process pids to titles, annotate process names with this when rendering to distinguish between them
|
||||
ipcRenderer.on('windowsInfoResponse', (event, windows) => {
|
||||
ipcRenderer.on('vscode:windowsInfoResponse', (event, windows) => {
|
||||
mapPidToWindowTitle = new Map<number, string>();
|
||||
windows.forEach(window => mapPidToWindowTitle.set(window.pid, window.title));
|
||||
});
|
||||
|
||||
@@ -79,11 +79,6 @@
|
||||
</body>
|
||||
|
||||
<script>
|
||||
const electron = require('electron');
|
||||
const shell = electron.shell;
|
||||
const ipc = electron.ipcRenderer;
|
||||
const remote = electron.remote;
|
||||
const currentWindow = remote.getCurrentWindow();
|
||||
|
||||
function promptForCredentials(data) {
|
||||
return new Promise((c, e) => {
|
||||
|
||||
Reference in New Issue
Block a user