logger import reordering

This commit is contained in:
Tamius Han 2019-09-03 23:01:23 +02:00
parent 7ac5e17415
commit 59df28029f
10 changed files with 12 additions and 11 deletions

View File

@ -5,12 +5,12 @@ import ExtensionMode from '../../common/enums/extension-mode.enum';
class ActionHandler { class ActionHandler {
constructor(pageInfo) { constructor(pageInfo) {
this.logger = pageInfo.logger;
this.pageInfo = pageInfo; this.pageInfo = pageInfo;
this.settings = pageInfo.settings; this.settings = pageInfo.settings;
this.inputs = ['input', 'select', 'button', 'textarea']; this.inputs = ['input', 'select', 'button', 'textarea'];
this.keyboardLocalDisabled = false; this.keyboardLocalDisabled = false;
this.logger = pageInfo.logger;
} }
init() { init() {

View File

@ -13,6 +13,7 @@ class Settings {
constructor(options) { constructor(options) {
// Options: activeSettings, updateCallback, logger // Options: activeSettings, updateCallback, logger
this.logger = options.logger;
const activeSettings = options.activeSettings; const activeSettings = options.activeSettings;
const updateCallback = options.updateCallback; const updateCallback = options.updateCallback;
@ -22,7 +23,6 @@ class Settings {
this.useSync = false; this.useSync = false;
this.version = undefined; this.version = undefined;
this.updateCallback = updateCallback; this.updateCallback = updateCallback;
this.logger = options.logger;
const ths = this; const ths = this;

View File

@ -3,6 +3,7 @@ import BrowserDetect from '../../conf/BrowserDetect';
class CommsClient { class CommsClient {
constructor(name, settings, logger) { constructor(name, settings, logger) {
this.logger = logger;
if (BrowserDetect.firefox) { if (BrowserDetect.firefox) {
this.port = browser.runtime.connect({name: name}); this.port = browser.runtime.connect({name: name});
} else if (BrowserDetect.chrome) { } else if (BrowserDetect.chrome) {
@ -18,7 +19,6 @@ class CommsClient {
this.settings = settings; this.settings = settings;
this.pageInfo = undefined; this.pageInfo = undefined;
this.commsId = (Math.random() * 20).toFixed(0); this.commsId = (Math.random() * 20).toFixed(0);
this.logger = logger;
} }
destroy() { destroy() {

View File

@ -10,6 +10,7 @@ if(Debug.debug)
class PageInfo { class PageInfo {
constructor(comms, settings, logger, extensionMode, readOnly = false){ constructor(comms, settings, logger, extensionMode, readOnly = false){
this.logger = logger;
this.hasVideos = false; this.hasVideos = false;
this.siteDisabled = false; this.siteDisabled = false;
this.videos = []; this.videos = [];
@ -20,7 +21,6 @@ class PageInfo {
this.extensionMode = extensionMode; this.extensionMode = extensionMode;
this.readOnly = readOnly; this.readOnly = readOnly;
this.logger = logger;
if (comms){ if (comms){
this.comms = comms; this.comms = comms;

View File

@ -34,6 +34,7 @@ if(Debug.debug)
class PlayerData { class PlayerData {
constructor(videoData) { constructor(videoData) {
this.logger = videoData.logger;
this.videoData = videoData; this.videoData = videoData;
this.video = videoData.video; this.video = videoData.video;
this.settings = videoData.settings; this.settings = videoData.settings;
@ -41,7 +42,6 @@ class PlayerData {
this.element = undefined; this.element = undefined;
this.dimensions = undefined; this.dimensions = undefined;
this.overlayNode = undefined; this.overlayNode = undefined;
this.logger = videoData.logger;
this.observer = new MutationObserver(this.onPlayerDimensionsChanged); this.observer = new MutationObserver(this.onPlayerDimensionsChanged);

View File

@ -6,13 +6,13 @@ import ArDetector from '../ar-detect/ArDetector';
class VideoData { class VideoData {
constructor(video, settings, pageInfo){ constructor(video, settings, pageInfo){
this.logger = pageInfo.logger;
this.arSetupComplete = false; this.arSetupComplete = false;
this.video = video; this.video = video;
this.destroyed = false; this.destroyed = false;
this.settings = settings; this.settings = settings;
this.pageInfo = pageInfo; this.pageInfo = pageInfo;
this.extensionMode = pageInfo.extensionMode; this.extensionMode = pageInfo.extensionMode;
this.logger = pageInfo.logger;
this.vdid = (Math.random()*100).toFixed(); this.vdid = (Math.random()*100).toFixed();
this.userCssClassName = `uw-fuck-you-and-do-what-i-tell-you_${this.vdid}`; this.userCssClassName = `uw-fuck-you-and-do-what-i-tell-you_${this.vdid}`;

View File

@ -16,11 +16,11 @@ class Resizer {
constructor(videoData) { constructor(videoData) {
this.conf = videoData; this.conf = videoData;
this.logger = videoData.logger;
this.video = videoData.video; this.video = videoData.video;
this.settings = videoData.settings; this.settings = videoData.settings;
this.extensionMode = videoData.extensionMode; this.extensionMode = videoData.extensionMode;
this.logger = videoData.logger;
this.scaler = new Scaler(this.conf); this.scaler = new Scaler(this.conf);
this.stretcher = new Stretcher(this.conf); this.stretcher = new Stretcher(this.conf);

View File

@ -12,9 +12,9 @@ class Stretcher {
// functions // functions
constructor(videoData) { constructor(videoData) {
this.conf = videoData; this.conf = videoData;
this.logger = videoData.logger;
this.settings = videoData.settings; this.settings = videoData.settings;
this.mode = this.settings.getDefaultStretchMode(window.location.hostname); this.mode = this.settings.getDefaultStretchMode(window.location.hostname);
this.logger = videoData.logger;
} }
setStretchMode(stretchMode) { setStretchMode(stretchMode) {

View File

@ -6,13 +6,14 @@ import Debug from '../../conf/Debug';
class Zoom { class Zoom {
// functions // functions
constructor(videoData) { constructor(videoData) {
this.conf = videoData;
this.logger = videoData.logger;
this.scale = 1; this.scale = 1;
this.logScale = 0; this.logScale = 0;
this.scaleStep = 0.1; this.scaleStep = 0.1;
this.minScale = -1; // 50% (log2(0.5) = -1) this.minScale = -1; // 50% (log2(0.5) = -1)
this.maxScale = 3; // 800% (log2(8) = 3) this.maxScale = 3; // 800% (log2(8) = 3)
this.conf = videoData;
this.logger = videoData.logger;
} }
reset(){ reset(){

View File

@ -65,8 +65,8 @@ class UW {
'arDetect_verbose': false, 'arDetect_verbose': false,
} }
}; };
// this.logger = new Logger(this.settings.getLoggingOptions);
this.logger = new Logger(loggingOptions); this.logger = new Logger(loggingOptions);
// await this.logger.init(); // not needed if logging options are provided at creation
} }
} catch (e) { } catch (e) {
console.error("logger init failed!", e) console.error("logger init failed!", e)