Fix comms
This commit is contained in:
parent
b222ea81c7
commit
2619b02263
@ -3,7 +3,7 @@ if(Debug.debug){
|
||||
}
|
||||
|
||||
class CommsClient {
|
||||
constructor(name) {
|
||||
constructor(name, settings) {
|
||||
if (BrowserDetect.firefox) {
|
||||
this.port = browser.runtime.connect({name: name});
|
||||
} else if (BrowserDetect.chrome) {
|
||||
@ -12,13 +12,10 @@ class CommsClient {
|
||||
this.port = browser.runtime.connect({name: name})
|
||||
}
|
||||
|
||||
console.log("BrowserDetect", BrowserDetect)
|
||||
console.log("!! port", this.port)
|
||||
var ths = this;
|
||||
this.port.onMessage.addListener(m => ths.processReceivedMessage(m));
|
||||
this.hasSettings = false;
|
||||
|
||||
this.settings = new Settings();
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
setPageInfo(pageInfo){
|
||||
@ -33,7 +30,7 @@ class CommsClient {
|
||||
if (message.cmd === "set-ar") {
|
||||
this.pageInfo.setAr(message.ratio);
|
||||
} else if (message.cmd === 'set-video-float') {
|
||||
this.settings.active.miscFullscreenthis.settings.videoFloat = message.newFloat;
|
||||
this.settings.active.miscFullscreenSettings.videoFloat = message.newFloat;
|
||||
this.pageInfo.restoreAr();
|
||||
} else if (message.cmd === "has-videos") {
|
||||
|
||||
|
@ -23,9 +23,9 @@ class UWServer {
|
||||
|
||||
var ths = this;
|
||||
if(BrowserDetect.firefox) {
|
||||
browser.tabs.onActivated.addListener((m) => ths.onTabSwitched(m));
|
||||
browser.tabs.onActivated.addListener(function(m) {ths.onTabSwitched(m)});
|
||||
} else if (BrowserDetect.chrome) {
|
||||
chrome.tabs.onActivated.addListener((m) => ths.onTabSwitched(m));
|
||||
chrome.tabs.onActivated.addListener(function(m) {ths.onTabSwitched(m)});
|
||||
}
|
||||
}
|
||||
|
||||
|
9
js/uw.js
9
js/uw.js
@ -21,7 +21,11 @@ async function init(){
|
||||
if(Debug.debug)
|
||||
console.log("[uw::main] loading configuration ...");
|
||||
|
||||
comms = new CommsClient('content-client-port');
|
||||
|
||||
settings = new Settings();
|
||||
await settings.init();
|
||||
|
||||
comms = new CommsClient('content-client-port', settings);
|
||||
|
||||
// load settings
|
||||
// var settingsLoaded = await comms.requestSettings();
|
||||
@ -39,8 +43,7 @@ async function init(){
|
||||
// if(Debug.debug)
|
||||
// console.log("[uw::main] configuration should be loaded now");
|
||||
|
||||
settings = new Settings();
|
||||
await settings.init();
|
||||
|
||||
|
||||
console.log("SETTINGS SHOULD BE LOADED NOW!", settings)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user