Skip to content

Commit

Permalink
Merge branch '1.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
dauphine-dev committed Mar 11, 2023
2 parents c3b0c7a + 4af048a commit 1132c03
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
15 changes: 13 additions & 2 deletions js/independent/background.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*global browser*/
/*global browser chrome*/
'use strict';
//const SIDEBAR_URL = '/html/sidebar.html';

class BackgroundManager {
static get instance() { return (this._instance = this._instance || new this()); }

constructor() {
this._windowList = [];
this._windowId = null;
this._portKeepAlive = null;
}

async init_async() {
Expand All @@ -20,6 +20,7 @@ class BackgroundManager {
} else {
browser.browserAction.onClicked.addListener((e) => { this._toggleDropFeedsPanel_async(e); });
}
this.keepMeAlive();
}

async _windowOnFocused_event(windowId) {
Expand Down Expand Up @@ -55,5 +56,15 @@ class BackgroundManager {
let self = BackgroundManager.instance;
self._windowList.push(message.sidebarWindowId);
}

async keepMeAlive() {
setInterval(() => {
if (this._portKeepAlive == null) {
this._portKeepAlive = chrome.runtime.connect({ name: 'keep-background-script-alive' });
this._portKeepAlive.onDisconnect.addListener(() => { this._portKeepAlive = null; });
}
if (this._portKeepAlive) { this._portKeepAlive.postMessage({ content: 'keep-me-alive' }); }
}, 15000);
}
}
BackgroundManager.instance.init_async();
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default_locale": "en",
"name": "Drop feeds",
"description": "__MSG_manExtensionDescription__",
"version": "1.0.16.200000002",
"version": "1.0.16.300000002",
"browser_specific_settings": {
"gecko": {
"id": "{42d52ade-6923-4f20-92d1-8db031269cc6}",
Expand Down
2 changes: 1 addition & 1 deletion manifestv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default_locale": "en",
"name": "Drop feeds",
"description": "__MSG_manExtensionDescription__",
"version": "1.0.16.200000002",
"version": "1.0.16.300000002",
"browser_specific_settings": {
"gecko": {
"id": "{42d52ade-6923-4f20-92d1-8db031269cc6}",
Expand Down
2 changes: 1 addition & 1 deletion manifestv3.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default_locale": "en",
"name": "Drop feeds",
"description": "__MSG_manExtensionDescription__",
"version": "1.0.16.200000003",
"version": "1.0.16.300000003",
"browser_specific_settings": {
"gecko": {
"id": "{42d52ade-6923-4f20-92d1-8db031269cc6}",
Expand Down

0 comments on commit 1132c03

Please sign in to comment.