diff --git a/options/options.js b/options/options.js index ecea9284..1798e20c 100644 --- a/options/options.js +++ b/options/options.js @@ -1,3 +1,7 @@ +/** + * @typedef {import('../common')} + */ + 'use strict'; ( ( () => diff --git a/scripts/common.js b/scripts/common.js index 86e97445..be597301 100644 --- a/scripts/common.js +++ b/scripts/common.js @@ -22,6 +22,10 @@ var ExtensionApi = ( () => // eslint-disable-next-line no-var var CurrentAppID; +/** + * @param {String} url + * @returns {Number} + */ function GetAppIDFromUrl( url ) { const appid = url.match( /\/(?:app|sub|bundle|friendsthatplay|gamecards|recommended|widget)\/(?[0-9]+)/ ); @@ -44,6 +48,11 @@ function GetHomepage() return 'https://steamdb.info/'; } +/** + * @param {String} message + * @param {String[]} substitutions + * @returns {String} + */ function _t( message, substitutions = [] ) { return ExtensionApi.i18n.getMessage( message, substitutions ); @@ -54,11 +63,23 @@ function GetLanguage() return ExtensionApi.i18n.getUILanguage(); } +/** + * @callback GetOptionCallback + * @param {{[key: string]: any}} items + */ + +/** + * @param {{[key: string]: any}} items + * @param {GetOptionCallback} callback + */ function GetOption( items, callback ) { ExtensionApi.storage.sync.get( items ).then( callback ); } +/** + * @param {String} option + */ function SetOption( option, value ) { const obj = {}; @@ -67,11 +88,23 @@ function SetOption( option, value ) ExtensionApi.storage.sync.set( obj ); } +/** + * @param {String} res + */ function GetLocalResource( res ) { return ExtensionApi.runtime.getURL( res ); } +/** + * @callback SendMessageToBackgroundScriptCallback + * @param {{success: Boolean, error?: String}?} data + */ + +/** + * @param {String} message + * @param {SendMessageToBackgroundScriptCallback} callback + */ function SendMessageToBackgroundScript( message, callback ) { const errorCallback = ( error ) => callback( { success: false, error: error.message } ); diff --git a/scripts/steamdb/global.js b/scripts/steamdb/global.js index 0c6a1b0e..8bfdf8bd 100644 --- a/scripts/steamdb/global.js +++ b/scripts/steamdb/global.js @@ -1,3 +1,7 @@ +/** + * @typedef {import('../common')} + */ + 'use strict'; const EXTENSION_INTEROP_VERSION = 2; diff --git a/scripts/store/app.js b/scripts/store/app.js index 4bc0c5d6..63a7508b 100644 --- a/scripts/store/app.js +++ b/scripts/store/app.js @@ -1,3 +1,7 @@ +/** + * @typedef {import('../common')} + */ + /* global AddLinksInErrorBox */ 'use strict';