Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/background/Extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,9 @@ export default class Extension {
console.log('getting settings')
sendResponse(this.get_settings())

} else if (msg.hasOwnProperty('keep_alive')){
sendResponse({alive: true})

} else if (msg.hasOwnProperty('download_page')){
const pageData = {
url: 'data:text/html;charset=utf-8,' + encodeURIComponent(msg.content),
Expand Down
5 changes: 5 additions & 0 deletions src/content/ContentHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class ContentHandler {
this.debug = true; //false;
this.onBackendMessage = this.onBackendMessage.bind(this);
this.settings = {}
this.keepAliveTimer = null;

}

Expand Down Expand Up @@ -319,6 +320,10 @@ export default class ContentHandler {
if (this.debug) console.log('onStart this.sendMessage');
});

// keep alive connection to avoid browser disabling the serviceworker
setInterval(() => {
this.browser.runtime.sendMessage({ keep_alive: true }).catch(() => {});
}, 25000);

// connect to the backend
this.browser.runtime.connect({
Expand Down