Worker(config) → {void}

This class contains methods for managing IITC and plugins.

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:
void

Classes

Worker

Methods

async, private _checkExternalUpdates(forceopt) → {Promise.<void>}

Runs periodic checks and installs updates for external plugins.

Parameters:
Name Type Attributes Default Description
force boolean <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
force boolean <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
data Object

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
data Object

Data from received meta.json file.

Returns:
Object.<string, plugin> -
  • Dictionary of plugin name and plugin data.

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
url string

URL of the resource you want to fetch.

variant "parseJSON" | "Last-Modified" | null <optional>
null

Type of request (see ajaxGet).

retry boolean | 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_plugins Object.<string, plugin>

Dictionary of plugins downloaded from the server.

plugins_local Object.<string, plugin>

Dictionary of installed plugins from IITC-CE distribution.

plugins_user Object.<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
categories Object.<string, Object.<string, string>>

Dictionary with names and descriptions of categories.

plugins_user Object.<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
channel string

Current channel.

options storage.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_event once 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
channel string

Current channel.

uids Array.<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
key string

Storage entry key.

defaults string | number | object

Default value.

override string | 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
channel string

Current channel.

local storage.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
channel string

Current channel.

local storage.data

Data from storage.

last_modified string | 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
channel string

Current channel.

plugins_flat Object.<string, plugin>

Data from storage, key "[channel]_plugins_flat".

plugins_local Object.<string, plugin>

Data from storage, key "[channel]_plugins_local".

Returns:
Promise.<Object.<string, plugin>>