mirror of
https://github.com/chinchang/web-maker.git
synced 2025-06-10 11:45:10 +02:00
takeScreenshot: remove debugger
This commit is contained in:
parent
c52a2f45f3
commit
fb016d9580
@ -1,6 +1,4 @@
|
|||||||
import {
|
import { handleDownloadsPermission } from './utils';
|
||||||
handleDownloadsPermission
|
|
||||||
} from "./utils";
|
|
||||||
|
|
||||||
function saveScreenshot(dataURI) {
|
function saveScreenshot(dataURI) {
|
||||||
// convert base64 to raw binary data held in a string
|
// convert base64 to raw binary data held in a string
|
||||||
@ -45,10 +43,11 @@ function saveScreenshot(dataURI) {
|
|||||||
'/temporary/' +
|
'/temporary/' +
|
||||||
fileName;
|
fileName;
|
||||||
|
|
||||||
chrome.downloads.download({
|
chrome.downloads.download(
|
||||||
|
{
|
||||||
url: filePath
|
url: filePath
|
||||||
},
|
},
|
||||||
function () {
|
function() {
|
||||||
// If there was an error, just open the screenshot in a tab.
|
// If there was an error, just open the screenshot in a tab.
|
||||||
// This happens in incognito mode where extension cannot access filesystem.
|
// This happens in incognito mode where extension cannot access filesystem.
|
||||||
if (chrome.runtime.lastError) {
|
if (chrome.runtime.lastError) {
|
||||||
@ -68,7 +67,8 @@ function saveScreenshot(dataURI) {
|
|||||||
size,
|
size,
|
||||||
fs => {
|
fs => {
|
||||||
fs.root.getFile(
|
fs.root.getFile(
|
||||||
fileName, {
|
fileName,
|
||||||
|
{
|
||||||
create: true
|
create: true
|
||||||
},
|
},
|
||||||
fileEntry => {
|
fileEntry => {
|
||||||
@ -116,13 +116,13 @@ export function takeScreenshot(boundRect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
debugger
|
|
||||||
chrome.tabs.captureVisibleTab(
|
chrome.tabs.captureVisibleTab(
|
||||||
null, {
|
null,
|
||||||
|
{
|
||||||
format: 'png',
|
format: 'png',
|
||||||
quality: 100
|
quality: 100
|
||||||
},
|
},
|
||||||
function (dataURI) {
|
function(dataURI) {
|
||||||
s.remove();
|
s.remove();
|
||||||
if (dataURI) {
|
if (dataURI) {
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
@ -135,4 +135,4 @@ export function takeScreenshot(boundRect) {
|
|||||||
|
|
||||||
trackEvent('ui', 'takeScreenshotBtnClick');
|
trackEvent('ui', 'takeScreenshotBtnClick');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user