Fix sendRemoveListener on closed conduit when unloading a page (#312)
* Update simple-translate.js * Update background.js * Update manifest.json * Delete background.js * Delete manifest.json * Delete simple-translate.js * Update index.js
This commit is contained in:
parent
8606f1e347
commit
b5d5970a85
|
@ -9,6 +9,7 @@ const init = async () => {
|
|||
await initSettings();
|
||||
document.addEventListener("mouseup", handleMouseUp);
|
||||
document.addEventListener("keydown", handleKeyDown);
|
||||
window.addEventListener("unload", onUnload, { once: true });
|
||||
browser.storage.onChanged.addListener(handleSettingsChange);
|
||||
browser.runtime.onMessage.addListener(handleMessage);
|
||||
overWriteLogLevel();
|
||||
|
@ -132,6 +133,10 @@ const handleKeyDown = e => {
|
|||
}
|
||||
};
|
||||
|
||||
const onUnload = () => {
|
||||
browser.storage.onChanged.removeListener(handleSettingsChange);
|
||||
};
|
||||
|
||||
let isEnabled = true;
|
||||
const handleMessage = async request => {
|
||||
const empty = new Promise(resolve => {
|
||||
|
|
Loading…
Reference in a new issue