Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius David Wieschollek <passwords.public@mdns.eu>2020-01-08 18:10:43 +0300
committerMarius David Wieschollek <passwords.public@mdns.eu>2020-01-08 18:10:43 +0300
commitbc60f8d67da4dc00c2d6167afa5e556137e69408 (patch)
tree8e9c96b587f17d416caac6a840d2f1bcfe8564e9 /src/js/Manager/RecommendationManager.js
parent2a9b462f35ec8b7eaec4f209f4ef316366ab32c1 (diff)
Added tab content client script
Diffstat (limited to 'src/js/Manager/RecommendationManager.js')
-rw-r--r--src/js/Manager/RecommendationManager.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/js/Manager/RecommendationManager.js b/src/js/Manager/RecommendationManager.js
index 424848c..105b463 100644
--- a/src/js/Manager/RecommendationManager.js
+++ b/src/js/Manager/RecommendationManager.js
@@ -4,6 +4,11 @@ import SearchQuery from '@js/Search/Query/SearchQuery';
import Url from 'url-parse';
class RecommendationManager {
+
+ constructor() {
+ this._enabled = false;
+ }
+
init() {
this._api = SystemService.getBrowserApi();
this._currentUrl = null;
@@ -20,6 +25,8 @@ class RecommendationManager {
this._api.tabs.onUpdated.addListener(this._tabEvent);
this._api.tabs.onReplaced.addListener(this._tabEvent);
this._api.tabs.onHighlighted.addListener(this._tabEvent);
+ this._enabled = true;
+
}
/**
@@ -27,13 +34,15 @@ class RecommendationManager {
* @returns {Password[]}
*/
async getRecommendations() {
+ if(!this._enabled) return [];
+
await this._updateRecommendations();
return this._recommendations;
}
async _updateRecommendations() {
let start = new Date().getTime();
- let tabs = await this._api.tabs.query({active: true});
+ let tabs = await this._api.tabs.query({currentWindow: true, active: true});
if(tabs.length !== 1) return;
let tab = tabs.pop();