From d70783cc8287ec320145a0a5cab09ced1c6456bd Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 28 Sep 2022 00:39:20 +0200 Subject: [PATCH] Rename canStartExtension to more descriptive isEnabledForSite --- src/ext/lib/Settings.ts | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/ext/lib/Settings.ts b/src/ext/lib/Settings.ts index ad6ae91..a164be1 100644 --- a/src/ext/lib/Settings.ts +++ b/src/ext/lib/Settings.ts @@ -422,15 +422,15 @@ class Settings { } } - canStartExtension(site) { - // returns 'true' if extension can be started on a given site. Returns false if we shouldn't run. + /** + * Returns whether extension can start on a given site or not. + * @param site — default value fof this argument is window.location.hostname + * @returns true if extension can run on this site, false otherwise + */ + isEnabledForSite(site = window.location.hostname) { if (!site) { - site = window.location.hostname; - - if (!site) { - this.logger?.log('info', 'settings', `[Settings::canStartExtension] window.location.hostname is null or undefined: ${window.location.hostname} \nactive settings:`, this.active); - return false; - } + this.logger?.log('info', 'settings', `[Settings::canStartExtension] window.location.hostname is null or undefined: ${window.location.hostname} \nactive settings:`, this.active); + return false; } // if (Debug.debug) { @@ -486,10 +486,6 @@ class Settings { return this.active.sites['@global'].mode !== ExtensionMode.Disabled } - extensionEnabledForSite(site) { - return this.canStartExtension(site); - } - canStartAutoAr(site?: string) { // 'site' argument is only ever used when calling this function recursively for debugging if (!site) {