new Worker(config) → {void}
Creates an instance of Manager class with the specified parameters
Parameters:
| Name | Type | Description |
|---|---|---|
config |
manager.config | Environment parameters for an instance of Manager class. |
Returns:
voidClasses
Methods
-
async, private _checkExternalUpdates(forceopt) → {Promise.<void>}
-
Runs periodic checks and installs updates for external plugins.
Parameters:
Name Type Attributes Default Description forceboolean <optional>
false Forced to run the update right now.
Returns:
Promise.<void> -
async, private _checkInternalUpdates(forceopt) → {Promise.<void>}
-
Runs periodic checks and installs updates for IITC and plugins.
Parameters:
Name Type Attributes Default Description forceboolean <optional>
false Forced to run the update right now.
Returns:
Promise.<void> -
private _getCategories(data) → {Object.<string, Object.<string, string>>}
-
Builds a dictionary from received meta.json file, in which it places names and descriptions of categories.
Parameters:
Name Type Description dataObject Data from received meta.json file.
Returns:
Object.<string, Object.<string, string>> -} - Dictionary with names and descriptions of categories.
-
private _getPluginsFlat(data) → {Object.<string, plugin>}
-
Converting a list of categories with plugins inside into a flat structure.
Parameters:
Name Type Description dataObject Data from received meta.json file.
-
async, private _getUrl(url, variantopt, retryopt) → {Promise.<(string|object|null)>}
-
The method requests data from the specified URL. It is a wrapper over ajaxGet function, with the addition of retries to load in case of problems and a message to user about errors.
Parameters:
Name Type Attributes Default Description urlstring URL of the resource you want to fetch.
variant"parseJSON" | "Last-Modified" | null <optional>
null Type of request (see ajaxGet).
retryboolean | number <optional>
Is retry in case of an error | number of request attempt.
Returns:
Promise.<(string|object|null)> -
async, private _init() → {Promise.<void>}
-
Set values for the class properties.
Returns:
Promise.<void> -
private _rebuildingArrayCategoriesPlugins(raw_plugins, plugins_local, plugins_user) → {Object.<string, plugin>}
-
Rebuilds the plugins array maintaining proper isolation between channels.
Parameters:
Name Type Description raw_pluginsObject.<string, plugin> Dictionary of plugins downloaded from the server.
plugins_localObject.<string, plugin> Dictionary of installed plugins from IITC-CE distribution.
plugins_userObject.<string, plugin> Dictionary of external UserScripts.
Returns:
Object.<string, plugin> -
_rebuildingCategories(categories, plugins_user) → {Object.<string, Object.<string, string>>}
-
Updates categories by adding custom categories of external plugins.
Parameters:
Name Type Description categoriesObject.<string, Object.<string, string>> Dictionary with names and descriptions of categories.
plugins_userObject.<string, plugin> Dictionary of external UserScripts.
Returns:
Object.<string, Object.<string, string>> -- Dictionary with names and descriptions of categories.
-
async, private _save(channel, options) → {Promise.<void>}
-
Saves passed data to local storage. Adds the name of release branch before key, if necessary.
Parameters:
Name Type Description channelstring Current channel.
optionsstorage.data Key-value data to be saved.
Returns:
Promise.<void> -
async _sendPluginsEvent(channel, uids, event, update_typeopt) → {Promise.<void>}
-
Asynchronously sends an event for a list of plugins based on the given parameters. It calls
plugin_eventonce with the event type and a map of the selected plugins. If the action is "remove", the plugins are represented by empty objects.Parameters:
Name Type Attributes Description channelstring Current channel.
uidsArray.<string> Array of unique identifiers (UID) of plugins.
event'add' | 'update' | 'remove' The type of event to handle.
update_type'local' | 'user' <optional>
Specifies the update type to determine which plugin versions to use. When set to 'local', actions with plugins marked as "user" are ignored, and vice versa. This parameter is intended to ignore updates from 'local' plugins when a 'user' plugin is used, and vice versa. If not specified, no ignoring logic is applied, and the function attempts to process the plugin event based on available data.
Returns:
Promise.<void> -A promise that resolves when the event has been processed.
-
async, private _syncStorage(key, defaults, overrideopt) → {Promise.<(string|number|object)>}
-
Overwrites the values in the storage and returns the new value. If the value is not set, the default value is returned.
Parameters:
Name Type Attributes Description keystring Storage entry key.
defaultsstring | number | object Default value.
overridestring | number | object | undefined <optional>
Value to override the default value.
Returns:
Promise.<(string|number|object)> -
async, private _updateExternalPlugins(channel, local) → {Promise.<void>}
-
Updates external plugins.
Parameters:
Name Type Description channelstring Current channel.
localstorage.data Data from storage.
Returns:
Promise.<void> -
async, private _updateInternalIITC(channel, local, last_modified) → {Promise.<void>}
-
Updates IITC, passes control to _updateLocalPlugins function to update plugins.
Parameters:
Name Type Description channelstring Current channel.
localstorage.data Data from storage.
last_modifiedstring | null Last modified date of "meta.json" file.
Returns:
Promise.<void> -
async, private _updateLocalPlugins(channel, plugins_flat, plugins_local) → {Promise.<Object.<string, plugin>>}
-
Updates plugins.
Parameters:
Name Type Description channelstring Current channel.
plugins_flatObject.<string, plugin> Data from storage, key "[channel]_plugins_flat".
plugins_localObject.<string, plugin> Data from storage, key "[channel]_plugins_local".
Returns:
Promise.<Object.<string, plugin>>