tabs.getZoomSettings()
获取指定标签页的当前缩放设置。
这是一个返回 Promise
的异步函数。
语法
js
let gettingZoomSettings = browser.tabs.getZoomSettings(
tabId // 可选整数
)
参数
tabId
可选-
integer
。要获取当前缩放设置的标签页的 ID。默认为当前窗口的活动标签页。
返回值
一个 Promise
,其会兑现一个 tabs.ZoomSettings
对象,表示标签页的当前缩放设置。如果找不到标签页或发生其他错误,promise 将会以错误信息拒绝。
示例
获取当前标签页的缩放设置:
js
function onGot(settings) {
console.log(settings);
}
function onError(error) {
console.log(`发生错误:${error}`);
}
let gettingZoomSettings = browser.tabs.getZoomSettings();
gettingZoomSettings.then(onGot, onError);
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
getZoomSettings |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
备注:
此 API 基于 Chromium 的 chrome.tabs
API。本文档来自 Chromium 代码中的 tabs.json
。