From 36967b18397dc7f6414d81584ea37f364195b164 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 21 Nov 2021 12:34:57 -0500 Subject: [PATCH] General refactoring (#2016) * Remove // Public comments * Fix errors * Remove source parameter from Popup*.setOptionsContext --- ext/js/app/popup-factory.js | 6 ++---- ext/js/app/popup-proxy.js | 8 ++------ ext/js/app/popup-window.js | 13 ++++--------- ext/js/app/popup.js | 4 ---- ext/js/data/database.js | 2 -- ext/js/language/dictionary-database.js | 2 -- 6 files changed, 8 insertions(+), 27 deletions(-) diff --git a/ext/js/app/popup-factory.js b/ext/js/app/popup-factory.js index 05ab1942..95587162 100644 --- a/ext/js/app/popup-factory.js +++ b/ext/js/app/popup-factory.js @@ -37,8 +37,6 @@ class PopupFactory { this._allPopupVisibilityTokenMap = new Map(); } - // Public functions - /** * Prepares the instance for use. */ @@ -225,9 +223,9 @@ class PopupFactory { }; } - async _onApiSetOptionsContext({id, optionsContext, source}) { + async _onApiSetOptionsContext({id, optionsContext}) { const popup = this._getPopup(id); - return await popup.setOptionsContext(optionsContext, source); + return await popup.setOptionsContext(optionsContext); } _onApiHide({id, changeFocus}) { diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js index d9e1af8d..85014c47 100644 --- a/ext/js/app/popup-proxy.js +++ b/ext/js/app/popup-proxy.js @@ -46,8 +46,6 @@ class PopupProxy extends EventDispatcher { this._frameOffsetExpireTimeout = 1000; } - // Public properties - /** * The ID of the popup. * @type {string} @@ -125,15 +123,13 @@ class PopupProxy extends EventDispatcher { return this._frameId; } - // Public functions - /** * Sets the options context for the popup. * @param {object} optionsContext The options context object. * @returns {Promise} */ - setOptionsContext(optionsContext, source) { - return this._invokeSafe('setOptionsContext', {id: this._id, optionsContext, source}); + setOptionsContext(optionsContext) { + return this._invokeSafe('setOptionsContext', {id: this._id, optionsContext}); } /** diff --git a/ext/js/app/popup-window.js b/ext/js/app/popup-window.js index 61c627b8..8f1a8355 100644 --- a/ext/js/app/popup-window.js +++ b/ext/js/app/popup-window.js @@ -38,8 +38,6 @@ class PopupWindow extends EventDispatcher { this._popupTabId = null; } - // Public properties - /** * The ID of the popup. * @type {string} @@ -59,7 +57,7 @@ class PopupWindow extends EventDispatcher { * @type {Popup} */ set parent(value) { - throw new Error('Not supported on PopupProxy'); + throw new Error('Not supported on PopupWindow'); } /** @@ -77,7 +75,7 @@ class PopupWindow extends EventDispatcher { * @throws Throws an error, since this class doesn't support children. */ set child(value) { - throw new Error('Not supported on PopupProxy'); + throw new Error('Not supported on PopupWindow'); } /** @@ -113,16 +111,13 @@ class PopupWindow extends EventDispatcher { return this._frameId; } - - // Public functions - /** * Sets the options context for the popup. * @param {object} optionsContext The options context object. * @returns {Promise} */ - setOptionsContext(optionsContext, source) { - return this._invoke(false, 'setOptionsContext', {id: this._id, optionsContext, source}); + setOptionsContext(optionsContext) { + return this._invoke(false, 'setOptionsContext', {id: this._id, optionsContext}); } /** diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js index 7581c8d7..8454dcb1 100644 --- a/ext/js/app/popup.js +++ b/ext/js/app/popup.js @@ -68,8 +68,6 @@ class Popup extends EventDispatcher { this._fullscreenEventListeners = new EventListenerCollection(); } - // Public properties - /** * The ID of the popup. * @type {string} @@ -143,8 +141,6 @@ class Popup extends EventDispatcher { return this._frameId; } - // Public functions - /** * Prepares the popup for use. */ diff --git a/ext/js/data/database.js b/ext/js/data/database.js index cc4f39f9..11339eab 100644 --- a/ext/js/data/database.js +++ b/ext/js/data/database.js @@ -21,8 +21,6 @@ class Database { this._isOpening = false; } - // Public - async open(databaseName, version, structure) { if (this._db !== null) { throw new Error('Database already open'); diff --git a/ext/js/language/dictionary-database.js b/ext/js/language/dictionary-database.js index 50435c51..25adb571 100644 --- a/ext/js/language/dictionary-database.js +++ b/ext/js/language/dictionary-database.js @@ -37,8 +37,6 @@ class DictionaryDatabase { this._createMediaBind = this._createMedia.bind(this); } - // Public - async prepare() { await this._db.open( this._dbName,