google-chrome-extension - chrome 扩展 - 为什么 'catch' 不执行?
问题描述
我正在使用来自chrome 开发人员网站的示例, 但问题是不执行?
/// background.js
chrome.tabs.onActivated.addListener(activeInfo => move(activeInfo));
async function move(activeInfo) {
try {
await chrome.tabs.move(activeInfo.tabId, {index: 0});
console.log('Success.');
} catch (error) {
if (error == 'Error: Tabs cannot be edited right now (user may be dragging a tab).') {
setTimeout(() => move(activeInfo), 50);
}
}
}
解决方案
推荐阅读
- c# - 在 C# 中,如何查看帐户中的第一个字符是否为特定值?
- google-app-engine - Go 应用引擎 dev_appserver.py 不支持运行时 go112
- pdf - p:media 在 FireFox 中不起作用,但在 Chrome 和 Opera 中有效
- mongodb - 使用 Studio 3T 时在 MongoDB 中选择不同的值
- pdf - 数字 PDF 文档签名
- python-3.x - 如何使用谷歌云路径(gs://)获取谷歌云存储桶中的所有训练文件和测试文件来训练ai平台中的作业
- linux - 如何在linux中打印搜索文本的行号
- apache-spark - 如何在每个时间窗口获取记录子集?
- gerrit - 如何在 gerrit 项目中默认启用注释已解析(未解析)标志
- python - 如何以特定方式标记我的重复值