本文整理匯總了TypeScript中electron.webFrame.setZoomLevel方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript webFrame.setZoomLevel方法的具體用法?TypeScript webFrame.setZoomLevel怎麽用?TypeScript webFrame.setZoomLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.webFrame
的用法示例。
在下文中一共展示了webFrame.setZoomLevel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: applyZoom
function applyZoom(zoomLevel: number): void {
webFrame.setZoomLevel(zoomLevel);
browser.setZoomFactor(webFrame.getZoomFactor());
// See https://github.com/Microsoft/vscode/issues/26151
// Cannot be trusted because the webFrame might take some time
// until it really applies the new zoom level
browser.setZoomLevel(webFrame.getZoomLevel(), /*isTrusted*/false);
}
示例2:
remote.getCurrentWebContents().print();
remote.getCurrentWindow().capturePage(buf => {
remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => {
console.log(err);
});
});
// web-frame
// 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.setVisualZoomLevelLimits(50, 200);
webFrame.setLayoutZoomLevelLimits(50, 200);
webFrame.setSpellCheckProvider('en-US', true, {
spellCheck: text => {
return !(require('spellchecker').isMisspelled(text));
}
});
webFrame.registerURLSchemeAsSecure('app');
webFrame.registerURLSchemeAsBypassingCSP('app');
webFrame.registerURLSchemeAsPrivileged('app');
webFrame.registerURLSchemeAsPrivileged('app', {
示例3: dispatchZoomOut
export function dispatchZoomOut() {
webFrame.setZoomLevel(webFrame.getZoomLevel() - 1);
}
示例4: dispatchZoomReset
export function dispatchZoomReset() {
webFrame.setZoomLevel(0);
}
示例5: dispatchZoomIn
export function dispatchZoomIn() {
webFrame.setZoomLevel(webFrame.getZoomLevel() + 1);
}