我正在尝试使用Chrome调试器扩展在Visual Studio代码中调试我的Typescript代码,但是我在断点上收到"未验证的断点"消息,并且执行不会在我的断点上停止.
这是我的launch.json文件:
{
linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"sourceMaps": true,
"webRoot": "${workspaceFolder}"
}
]
}
Run Code Online (Sandbox Code Playgroud)
应用版本:
我看到如果您有以下Chrome版本__CODE__,则会收到此错误消息.如果我打开Chrome并导航到__CODE__,我可以看到我的Chrome版本__CODE__.当我导航到__CODE__Visual Studio Code时,Chrome的版本显示为__CODE__.
不确定这是否相关,但如何更新Visual Studio Code中显示的Chrome版本,以反映正确的Chrome版本?
关于如何解决这个问题的任何其他建议?
我的chrome扩展程序具有以下两个JavaScript:
background.js,作为后台脚本运行:
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
if (message.data == "takeScreenshot") {
var resp = sendResponse;
chrome.tabs.captureVisibleTab(function(screenshotUrl) {
resp({
screenshot: screenshotUrl
});
});
return true; // Return true to tell that the response is sent asynchronously
} else {
return "TestReply";
}
});
Run Code Online (Sandbox Code Playgroud)
api.js,作为可通过网络访问的资源运行:
window.takeScreenshot = (function() {
var isTakingScreenshot = false; // Semaphore
return function() {
if(isTakingScreenshot) return Promise.reject();
isTakingScreenshot = true;
return new Promise(function(resolve, reject) {
chrome.runtime.sendMessage("eomfljlchjpefnempfimgminjnegpjod", "takeScreenshot", function(response) {
console.log(response);
isTakingScreenshot = false;
resolve(response.screenshot);
});
}); …Run Code Online (Sandbox Code Playgroud)