1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-02 11:30:22 +02:00

port import export

This commit is contained in:
Kushagra Gour
2018-06-08 11:07:14 +05:30
parent aaa9dc4c97
commit c1569184bf
3 changed files with 156 additions and 3 deletions

View File

@@ -403,6 +403,37 @@ export function saveAsHtml(item) {
});
}
export function handleDownloadsPermission() {
var d = deferred();
if (!window.IS_EXTENSION) {
d.resolve();
return d.promise;
}
chrome.permissions.contains({
permissions: ['downloads']
},
function (result) {
if (result) {
d.resolve();
} else {
chrome.permissions.request({
permissions: ['downloads']
},
function (granted) {
if (granted) {
trackEvent('fn', 'downloadsPermGiven');
d.resolve();
} else {
d.reject();
}
}
);
}
}
);
return d.promise;
}
window.chrome = window.chrome || {};
window.chrome.i18n = {
getMessage: () => {}