This commit is contained in:
Jeremy Rose 2020-06-30 12:49:08 -07:00 коммит произвёл GitHub
Родитель ee61eb9aa4
Коммит 451086d7f2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -223,7 +223,7 @@ auto_filenames = {
"lib/browser/api/views/image-view.ts",
"lib/browser/api/web-contents-view.ts",
"lib/browser/api/web-contents.js",
"lib/browser/chrome-extension-shim.js",
"lib/browser/chrome-extension-shim.ts",
"lib/browser/default-menu.ts",
"lib/browser/desktop-capturer.ts",
"lib/browser/devtools.ts",

Просмотреть файл

@ -1,23 +1,21 @@
'use strict';
// This is a temporary shim to aid in transition from the old
// BrowserWindow-based extensions stuff to the new native-backed extensions
// API.
const { app, session, BrowserWindow, deprecate } = require('electron');
import { app, session, BrowserWindow, deprecate } from 'electron';
app.whenReady().then(function () {
const addExtension = function (srcDirectory) {
const addExtension = function (srcDirectory: string) {
return session.defaultSession.loadExtension(srcDirectory);
};
const removeExtension = function (name) {
const removeExtension = function (name: string) {
const extension = session.defaultSession.getAllExtensions().find(e => e.name === name);
if (extension) { session.defaultSession.removeExtension(extension.id); }
};
const getExtensions = function () {
const extensions = {};
const extensions: Record<string, any> = {};
session.defaultSession.getAllExtensions().forEach(e => {
extensions[e.name] = e;
});

Просмотреть файл

@ -55,12 +55,12 @@ const deprecate: ElectronInternal.DeprecationUtil = {
};
},
moveAPI: (fn: Function, oldUsage: string, newUsage: string) => {
moveAPI<T extends Function> (fn: T, oldUsage: string, newUsage: string): T {
const warn = warnOnce(oldUsage, newUsage);
return function (this: any) {
warn();
return fn.apply(this, arguments);
};
} as any;
},
// change the name of an event

2
typings/internal-electron.d.ts поставляемый
Просмотреть файл

@ -147,7 +147,7 @@ declare namespace ElectronInternal {
event(emitter: NodeJS.EventEmitter, oldName: string, newName: string): void;
removeProperty<T, K extends (keyof T & string)>(object: T, propertyName: K, onlyForValues?: any[]): T;
renameProperty<T, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T;
moveAPI(fn: Function, oldUsage: string, newUsage: string): Function;
moveAPI<T extends Function>(fn: T, oldUsage: string, newUsage: string): T;
}
interface DesktopCapturer {