-
<static> add(resource) → {Object}
-
Add data about a resource into the list of available resources.
Parameters:
Name |
Type |
Description |
resource |
Object
|
Represents data about a resource that should be added.
Object should contain the following fields (name - type - description):
name - String - resource name (required)
description - String - resource description
url - String - URL of resource's site
tag - Array of String - tags/keywords of resource
note - String - additional information about resource usage
module - String - path to the module that should be used to work with resource;
the module should implement necessary API
api - Object - object that implements necessary API to work with resource
The only mandatory field is name . Also module or api field should be specified. |
- Source:
- See:
-
Throws:
-
Will throw an error if resource name is not specified.
-
Will throw an error if resource API object and path to resource module are not specified.
-
Will throw an error if there is a resource with the same name.
Returns:
Object that represents module exports
.
-
Type
-
Object
-
-
Check whether resource has one or all specified tags.
Parameters:
Name |
Type |
Argument |
Description |
resource |
Object
|
|
Represents data about a resource that should be checked. |
tagList |
Array
|
|
List of tags (in lower case) that should be checked on presence in resource tags. |
checkAllTags |
Boolean
|
<optional>
|
Whether all tags specified in tagList should be checked on presence in resource tags. |
- Source:
Returns:
true
if resource has one or all specified tags (depending on checkAllTags
value),
false
otherwise.
-
Type
-
Boolean
-
<static> filterList(settings) → {Object}
-
Apply filter on list of currently available resources.
After operation only resources conforming to filter will be available.
In essence, this method is a wrapper for the following code:
setList( getList(settings) )
Parameters:
Name |
Type |
Argument |
Description |
settings |
Object
|
<optional>
|
Specifies which resources should be selected.
The following settings can be used to select resources:
selectName, selectTag, checkAllTags .
See getList for details. |
- Source:
- See:
-
Returns:
Object that represents module exports
.
-
Type
-
Object
-
<static> getAllNameList() → {Array}
-
Return list that contains names of all available resources.
- Source:
- See:
-
Returns:
List that contains names of all available resources.
-
Type
-
Array
-
<static> getIdByName(name) → {String|null}
-
Return identifier of resource with given name.
Parameters:
Name |
Type |
Description |
name |
String
|
A resource name (case-insensitive). |
- Source:
Returns:
Identifier of resource that has the given name
or null
if no one of available resources has the specified name.
-
Type
-
String
|
null
-
<static> getList(settings) → {Array}
-
Return list of specified resources.
If no selection criteria is set then returns list of all available resources.
Parameters:
Name |
Type |
Argument |
Description |
settings |
Object
|
<optional>
|
Specifies which data items should be returned.
The following settings are supported (name - type - description):
includeApi - Boolean - whether API object for resource should be included into data item
under api field; false by default
selectName - Array | String - specifies filter for available resources by name;
list of names of resources or name of resource (case-insensitive) that should be included into result
selectTag - Array | String - specifies filter for available resources by tag;
list of tags or tag (case-insensitive) that should be used to select resources into result;
resources that have one or all specified tags (depending on checkAllTags setting)
will be included in result
checkAllTags - Boolean - specifies (when true ) that a resource
should be included into result only when it has all tags set by selectTag setting
Filter by name (selectName ) and filter by tag (selectTag )
can be used separately or together.
If no filter is specified, all resources will be included into result. |
- Source:
- See:
-
Returns:
List that contains objects presenting data about selected resources.
-
Type
-
Array
-
<static> getMap(settings) → {Object}
-
Return object that represents specified resources.
If no selection criteria is set then returns object that contains data about all available resources.
Parameters:
Name |
Type |
Argument |
Description |
settings |
Object
|
<optional>
|
Specifies which data items should be returned.
See getList for details. |
- Source:
- See:
-
Returns:
Object that contains data about selected resources.
Fields are resource keys, values are objects representing data about resources.
-
Type
-
Object
-
<static> getNameList(settings) → {Array}
-
Return list that contains names of selected resources.
If no selection criteria is set then returns list of names of all available resources.
Parameters:
Name |
Type |
Argument |
Description |
settings |
Object
|
<optional>
|
Specifies selection criteria. The following settings can be used to select resources:
selectName, selectTag, checkAllTags .
See getList for details. |
- Source:
- See:
-
Returns:
List that contains names of selected resources.
-
Type
-
Array
-
<static> initList(list) → {Object}
-
Set initial list of all available resources.
This list is used to
reset to initial state.
Parameters:
Name |
Type |
Description |
list |
Array
|
Object
|
List that contains objects presenting data about resources,
or object with data about an resource. |
- Source:
- See:
-
Returns:
Object that represents module exports
.
-
Type
-
Object
-
<static> isAvailable(name) → {Boolean}
-
Check whether there is a resource with given name.
Parameters:
Name |
Type |
Description |
name |
String
|
A name that should be checked (case-insensitive). |
- Source:
Returns:
true
if there is a resource with the given name,
false
if no one of available resources has the specified name.
-
Type
-
Boolean
-
<static> remove(name) → {Object|null}
-
Remove resource with given name from list of resources.
Parameters:
Name |
Type |
Description |
name |
String
|
Name of resource that should be removed (case-insensitive). |
- Source:
Returns:
Object that represents removed resource
or null
if no one of resources from list has the specified name.
-
Type
-
Object
|
null
-
<static> removeAll() → {Object}
-
Clear list of resources.
- Source:
- See:
-
Returns:
Object that represents module exports
.
-
Type
-
Object
-
<static> resetList() → {Object}
-
Set list of resources to initial state containing data about all available resources.
- Source:
- See:
-
Returns:
Object that represents module exports
.
-
Type
-
Object
-
<static> setList(list) → {Object}
-
Change list of available resources.
In essence this method
removes all available resources
and
adds data about each given resource into the list of available resources.
Parameters:
Name |
Type |
Description |
list |
Array
|
Object
|
List that contains objects presenting data about resources,
or object with data about an resource. |
- Source:
- See:
-
Returns:
Object that represents module exports
.
-
Type
-
Object