Global

Methods

addInstance(network, url) → {Promise.<boolean>}

Parameters:
Name Type Description
network string

The name of the network (e.g. 'mastodon' or 'lemmy')

url string

The URL of the instance to add.

Source:
Returns:

Promise which resolves to True if the instance addition was successful, False otherwise

Type
Promise.<boolean>

buildPage(HANDLERS)

Parameters:
Name Type Description
HANDLERS Array
Source:

fetchInstanceLists()

Fetches current instance lists from localStorage. If there aren't any in localStorage, sets them to the hardcoded defaults before returning them.

Source:
Returns:

The current set of instance lists, as an object of arrays indexed by network name.

handleRemoveInstance(network, url, storage)

Calls removeInstance -- if it's successful, remove corresponding element from UI.

Parameters:
Name Type Description
network string
url string
storage Storage
Source:

removeInstance(network, url, storage) → {number}

Removes an instance from localStorage. Currently O(n) with respect to number of instances.

Parameters:
Name Type Description
network string
url string
storage Storage
Source:
Returns:

Index removed if successful, -1 otherwise

Type
number

saveLists(instanceLists, storage)

Takes an object, stringifies it and stores it in storage.

Parameters:
Name Type Description
instanceLists Object

An object, should be pairs of network names and URL string arrays

storage *

The storage object to write to with the key 'instanceLists'

Source:

setDefaultLists(storage)

Loads hardcoded default instance lists into localStorage.

Parameters:
Name Type Description
storage Storage

The storage object to reset to default.

Source:

validUrl(url) → {boolean}

Parameters:
Name Type Description
url string

A URL string to validate

Source:
Returns:

true if the URL string is valid, false otherwise

Type
boolean