Comparing version 2.2.2 to 2.2.3
@@ -35,3 +35,3 @@ | ||
}); | ||
if(ports[tabId][1]){ | ||
if (ports[tabId][1]) { | ||
port.postMessage('🎟️'); | ||
@@ -68,1 +68,18 @@ } | ||
} | ||
chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { | ||
const { content } = message; | ||
switch (message.type) { | ||
case 'download': { | ||
const blob = new Blob([content], { type: "text/plain" }); | ||
const url = URL.createObjectURL(blob); | ||
chrome.downloads.download({ | ||
url, | ||
filename: 'data', | ||
}); | ||
break; | ||
} | ||
default: | ||
console.warn('unknown message type ' + message.type); | ||
} | ||
}); |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"permissions": ["tabs", "<all_urls>", "clipboardWrite", "clipboardRead"], | ||
"permissions": ["tabs", "<all_urls>", "clipboardWrite", "clipboardRead", "downloads"], | ||
"devtools_page": "devtools-page.html", | ||
@@ -16,0 +16,0 @@ "content_scripts": [ |
@@ -35,3 +35,3 @@ | ||
}); | ||
if(ports[tabId][1]){ | ||
if (ports[tabId][1]) { | ||
port.postMessage('🎟️'); | ||
@@ -68,1 +68,18 @@ } | ||
} | ||
chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { | ||
const { content } = message; | ||
switch (message.type) { | ||
case 'download': { | ||
const blob = new Blob([content], { type: "text/plain" }); | ||
const url = URL.createObjectURL(blob); | ||
chrome.downloads.download({ | ||
url, | ||
filename: 'data', | ||
}); | ||
break; | ||
} | ||
default: | ||
console.warn('unknown message type ' + message.type); | ||
} | ||
}); |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"permissions": ["tabs", "<all_urls>", "clipboardWrite", "clipboardRead"], | ||
"permissions": ["tabs", "<all_urls>", "clipboardWrite", "clipboardRead", "downloads"], | ||
"devtools_page": "devtools-page.html", | ||
@@ -16,0 +16,0 @@ "content_scripts": [ |
12
index.js
@@ -109,9 +109,11 @@ import EventEmitter from 'eventemitter3'; | ||
try { | ||
this[cacheResult] = await origin.apply(this, arg); | ||
if (abort.aborted) { | ||
const result = origin.apply(this, arg); | ||
if (result instanceof Promise) | ||
this[cacheResult] = await result; | ||
else | ||
this[cacheResult] = result; | ||
if (abort.aborted) | ||
return this[cacheResult]; | ||
} | ||
else { | ||
else | ||
this[abortCtrl] = void 0; | ||
} | ||
setState.call(this, to); | ||
@@ -118,0 +120,0 @@ return this[cacheResult]; |
10
index.ts
@@ -93,8 +93,10 @@ import EventEmitter from 'eventemitter3'; | ||
try { | ||
this[cacheResult] = await origin.apply(this, arg); | ||
if (abort.aborted) { | ||
const result = origin.apply(this, arg); | ||
if (result instanceof Promise) | ||
this[cacheResult] = await result; | ||
else this[cacheResult] = result; | ||
if (abort.aborted) | ||
return this[cacheResult]; | ||
} else { | ||
else | ||
this[abortCtrl] = void 0; | ||
} | ||
setState.call(this, to); | ||
@@ -101,0 +103,0 @@ return this[cacheResult]; |
{ | ||
"name": "afsm", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "automatic finite state machine", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3975088
18425