mirror of
https://github.com/michivonah/click-guide.git
synced 2025-12-22 22:16:28 +01:00
create the screenshot functionality
This commit is contained in:
parent
3363ec9acf
commit
f32a3b56ce
4 changed files with 52 additions and 3 deletions
|
|
@ -2,6 +2,18 @@
|
|||
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
console.log(message.action);
|
||||
if (message.action == "captureScreenshot"){
|
||||
chrome.tabs.captureVisibleTab(null, { format: "jpeg" }, (dataUrl) => {
|
||||
if (chrome.runtime.lastError) {
|
||||
console.error("Error capturing screenshot: ", chrome.runtime.lastError);
|
||||
sendResponse({ success: false, error: chrome.runtime.lastError });
|
||||
return;
|
||||
}
|
||||
|
||||
sendResponse({ success: true, screenshot: dataUrl });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
/*chrome.scripting.executeScript({
|
||||
target: {tabId: tabs[0].id},
|
||||
files: ['test.js']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue