aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/background.ts
diff options
context:
space:
mode:
authorMax Baumann <[email protected]>2020-12-12 22:57:41 +0100
committerMax Baumann <[email protected]>2020-12-12 22:57:41 +0100
commit36558f5460bb843598d72bff3998074dc40bbdaf (patch)
tree5ca88653e45162a1e220bdc7a043190bf0ce421f /src/background.ts
parent105c148ccc2ee589dc47716a963835687013d683 (diff)
downloadSponsorBlock-36558f5460bb843598d72bff3998074dc40bbdaf.tar.gz
SponsorBlock-36558f5460bb843598d72bff3998074dc40bbdaf.zip
refactor(lint): apply automatic eslint fixes
Diffstat (limited to 'src/background.ts')
-rw-r--r--src/background.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/background.ts b/src/background.ts
index ec398d59..bfb7b963 100644
--- a/src/background.ts
+++ b/src/background.ts
@@ -5,13 +5,13 @@ import Config from "./config";
(<any> window).SB = Config;
import Utils from "./utils";
-var utils = new Utils({
+const utils = new Utils({
registerFirefoxContentScript,
unregisterFirefoxContentScript
});
// Used only on Firefox, which does not support non persistent background pages.
-var contentScriptRegistrations = {};
+const contentScriptRegistrations = {};
// Register content script if needed
if (utils.isFirefox()) {
@@ -91,7 +91,7 @@ chrome.runtime.onInstalled.addListener(function (object) {
* @param {JSON} options
*/
function registerFirefoxContentScript(options) {
- let oldRegistration = contentScriptRegistrations[options.id];
+ const oldRegistration = contentScriptRegistrations[options.id];
if (oldRegistration) oldRegistration.unregister();
browser.contentScripts.register({
@@ -121,10 +121,10 @@ async function submitVote(type: number, UUID: string, category: string) {
Config.config.userID = userID;
}
- let typeSection = (type !== undefined) ? "&type=" + type : "&category=" + category;
+ const typeSection = (type !== undefined) ? "&type=" + type : "&category=" + category;
//publish this vote
- let response = await asyncRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + typeSection);
+ const response = await asyncRequestToServer("POST", "/api/voteOnSponsorTime?UUID=" + UUID + "&userID=" + userID + typeSection);
if (response.ok) {
return {
@@ -146,7 +146,7 @@ async function submitVote(type: number, UUID: string, category: string) {
}
async function asyncRequestToServer(type: string, address: string, data = {}) {
- let serverAddress = Config.config.testingServer ? CompileConfig.testingServerAddress : Config.config.serverAddress;
+ const serverAddress = Config.config.testingServer ? CompileConfig.testingServerAddress : Config.config.serverAddress;
return await (sendRequestToCustomServer(type, serverAddress + address, data));
}
@@ -162,8 +162,8 @@ async function sendRequestToCustomServer(type: string, url: string, data = {}) {
// If GET, convert JSON to parameters
if (type.toLowerCase() === "get") {
for (const key in data) {
- let seperator = url.includes("?") ? "&" : "?";
- let value = (typeof(data[key]) === "string") ? data[key]: JSON.stringify(data[key]);
+ const seperator = url.includes("?") ? "&" : "?";
+ const value = (typeof(data[key]) === "string") ? data[key]: JSON.stringify(data[key]);
url += seperator + key + "=" + value;
}