Syncrhonize apiClient with chrome storage

This commit is contained in:
Manuel Bouza
2019-02-06 11:12:22 +01:00
parent 76c51d4e94
commit 49aa36bf54
3 changed files with 46 additions and 44 deletions

View File

@@ -1,15 +1,18 @@
import DomainCheck from "./services/DomainCheck"
import apiClient from "api/client"
import config from "./config"
apiClient.registerStorage(chrome.storage)
apiClient.setClientVersion(chrome.runtime.getManifest().version)
const domainCheck = new DomainCheck(config)
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
// inject files only after the page is fully loaded
// run only after the page is fully loaded
if (changeInfo.status != "complete") {
return
}
// inject files only for supported services
const service = domainCheck.match(tab.url)
if (service) {