Class: DataSources

LocusZoom~DataSources(registryopt)

Create and coordinate an ensemble of (namespaced) data adapter instances. This is the mechanism by which users tell a plot how to retrieve data for a specific plot: adapters are created through this object rather than instantiating directly.

Constructor

new DataSources(registryopt)

Extends:
Parameters:
Name Type Attributes Description
registry RegistryBase <optional>

Primarily used for unit testing. When creating sources by name, specify where to find the registry of known sources.

Source:

Extends

Methods

add(namespace, item, overrideopt) → {DataSources}

For data sources, there is a special behavior of "create item from config, then add"

Parameters:
Name Type Attributes Default Description
namespace String

Uniquely identify this datasource

item BaseAdapter | Array

An instantiated datasource, or an array of arguments that can be used to create a known datasource type.

override <optional>
false

Whether to allow existing sources to be redefined

Overrides:
Source:
Returns:

Most registries return the created instance, but this registry returns a reference to itself (to support chaining)

Type
DataSources

get(name) → {function}

Return the registry member. If the registry stores classes, this returns the class, not the instance.

Parameters:
Name Type Description
name String
Overrides:
Source:
Returns:
Type
function

has(name) → {boolean}

Check whether the specified item is registered

Parameters:
Name Type Description
name String
Overrides:
Source:
Returns:
Type
boolean

list() → {Array.<String>}

Names of each allowed

Overrides:
Source:
Returns:
Type
Array.<String>

remove(name) → {boolean}

Remove a datasource from the registry (if present)

Parameters:
Name Type Description
name String
Overrides:
Source:
Returns:

True if item removed, false if item was never present

Type
boolean