Update web-frame module

This commit is contained in:
Milan Burda
2016-03-25 21:12:39 +01:00
parent e4ca24ac33
commit 93b00632d4
2 changed files with 32 additions and 1 deletions

View File

@@ -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

View File

@@ -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 pages 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.
*/