本文整理汇总了TypeScript中electron.webFrame.getZoomLevel方法的典型用法代码示例。如果您正苦于以下问题:TypeScript webFrame.getZoomLevel方法的具体用法?TypeScript webFrame.getZoomLevel怎么用?TypeScript webFrame.getZoomLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.webFrame
的用法示例。
在下文中一共展示了webFrame.getZoomLevel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: applyZoom
document.onkeydown = (e: KeyboardEvent) => {
const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
// Cmd/Ctrl + zooms in
if (cmdOrCtrlKey && e.keyCode === 187) {
applyZoom(webFrame.getZoomLevel() + 1);
}
// Cmd/Ctrl - zooms out
if (cmdOrCtrlKey && e.keyCode === 189) {
applyZoom(webFrame.getZoomLevel() - 1);
}
};
示例2: init
private init(): void {
// Enable gracefulFs
gracefulFs.gracefulify(fs);
// Massage configuration file URIs
this.reviveUris();
// Setup perf
importEntries(this.configuration.perfEntries);
// Browser config
setZoomFactor(webFrame.getZoomFactor()); // Ensure others can listen to zoom level changes
setZoomLevel(webFrame.getZoomLevel(), true /* isTrusted */); // Can be trusted because we are not setting it ourselves (https://github.com/Microsoft/vscode/issues/26151)
setFullscreen(!!this.configuration.fullscreen);
// Keyboard support
KeyboardMapperFactory.INSTANCE._onKeyboardLayoutChanged();
}
示例3:
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', {
secure: true,
示例4: dispatchZoomOut
export function dispatchZoomOut() {
webFrame.setZoomLevel(webFrame.getZoomLevel() - 1);
}
示例5: dispatchZoomIn
export function dispatchZoomIn() {
webFrame.setZoomLevel(webFrame.getZoomLevel() + 1);
}