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

- module:registry/base~RegistryBase

##### 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:
  - data/sources.js, line 14

### Extends

- module:registry/base~RegistryBase

### 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:
  - module:registry/base~RegistryBase#add
Source:
  - data/sources.js, line 35

##### 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:
  - module:registry/base~RegistryBase#get
Source:
  - registry/base.js, line 25

##### Returns:

Type
  function

#### has(name) → {boolean}

Check whether the specified item is registered

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String |

Overrides:
  - module:registry/base~RegistryBase#has
Source:
  - registry/base.js, line 61

##### Returns:

Type
  boolean

#### list() → {Array.<String>}

Names of each allowed

Overrides:
  - module:registry/base~RegistryBase#list
Source:
  - registry/base.js, line 69

##### Returns:

Type
  Array.<String>

#### remove(name) → {boolean}

Remove a datasource from the registry (if present)

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String |

Overrides:
  - module:registry/base~RegistryBase#remove
Source:
  - registry/base.js, line 52

##### Returns:

True if item removed, false if item was never present

Type
  boolean