本文整理匯總了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);
}