mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 09:01:45 +08:00
Update web-frame module
This commit is contained in:
@@ -50,6 +50,12 @@ remote.getCurrentWindow().capturePage(buf => {
|
||||
// https://github.com/atom/electron/blob/master/docs/api/web-frame.md
|
||||
|
||||
webFrame.setZoomFactor(2);
|
||||
console.log(webFrame.getZoomFactor());
|
||||
|
||||
webFrame.setZoomLevel(200);
|
||||
console.log(webFrame.getZoomLevel());
|
||||
|
||||
webFrame.setZoomLevelLimits(50, 200);
|
||||
|
||||
webFrame.setSpellCheckProvider('en-US', true, {
|
||||
spellCheck: text => {
|
||||
@@ -57,6 +63,16 @@ webFrame.setSpellCheckProvider('en-US', true, {
|
||||
}
|
||||
});
|
||||
|
||||
webFrame.registerURLSchemeAsSecure('app');
|
||||
webFrame.registerURLSchemeAsBypassingCSP('app');
|
||||
webFrame.registerURLSchemeAsPrivileged('app');
|
||||
|
||||
webFrame.insertText('text');
|
||||
|
||||
webFrame.executeJavaScript('JSON.stringify({})', false, (result) => {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
// clipboard
|
||||
// https://github.com/atom/electron/blob/master/docs/api/clipboard.md
|
||||
|
||||
|
||||
17
github-electron/github-electron.web-frame.d.ts
vendored
17
github-electron/github-electron.web-frame.d.ts
vendored
@@ -4,7 +4,9 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Electron {
|
||||
|
||||
/**
|
||||
* The web-frame module allows you to customize the rendering of the current web page.
|
||||
*/
|
||||
interface WebFrame {
|
||||
/**
|
||||
* Changes the zoom factor to the specified factor, zoom factor is
|
||||
@@ -25,6 +27,10 @@ declare namespace Electron {
|
||||
* @returns The current zoom level.
|
||||
*/
|
||||
getZoomLevel(): number;
|
||||
/**
|
||||
* Sets the maximum and minimum zoom level.
|
||||
*/
|
||||
setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
|
||||
/**
|
||||
* Sets a provider for spell checking in input fields and text areas.
|
||||
*/
|
||||
@@ -40,6 +46,15 @@ declare namespace Electron {
|
||||
* corrupted by active network attackers.
|
||||
*/
|
||||
registerURLSchemeAsSecure(scheme: string): void;
|
||||
/**
|
||||
* Resources will be loaded from this scheme regardless of the current page’s Content Security Policy.
|
||||
*/
|
||||
registerURLSchemeAsBypassingCSP(scheme: string): void;
|
||||
/**
|
||||
* Registers the scheme as secure, bypasses content security policy for resources,
|
||||
* allows registering ServiceWorker and supports fetch API.
|
||||
*/
|
||||
registerURLSchemeAsPrivileged(scheme: string): void;
|
||||
/**
|
||||
* Inserts text to the focused element.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user