Constructor
new CocodaSDK(configopt)
CDK constructor.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
config | Object | <optional> | {} | Cocoda-stye config object |
- Source
Members
config
Current configuration.
- Source
providers
Map of registered providers.
- Source
Methods
addProvider(provider)
Method to add custom provider.
Name | Type | Description |
---|---|---|
provider | Object | provider class that extends BaseProvider |
- Source
createInstance(config) → {CocodaSDK}
Creates a new CDK instance (same as new CocodaSDK(config)
).
Name | Type | Description |
---|---|---|
config | Object | Cocoda config object |
- Source
new CDK instance
- Type:
- CocodaSDK
getRegistryForUri(uri) → (nullable) {Object}
Method to get a registry by URI.
Name | Type | Description |
---|---|---|
uri | string | URI of registry in config |
- Source
initialized registry from config if found
- Type:
- Object
(async) getSchemes(configopt) → {Array.<Object>}
Gets schemes from all registries that support schemes and merges the results.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
config | Object | <optional> | {} | configuration object that will be used as a parameter for internal |
- Source
array of JSKOS schemes
- Type:
- Array.<Object>
initializeRegistry(registry) → {Object}
Method to initialize registry.
Name | Type | Description |
---|---|---|
registry | Object | JSKOS registry object |
- Source
initialized registry
- Type:
- Object
loadBuildInfo(config) → {Object}
Method to load buildInfo.
Callback will only be called if buildInfo changes; it will not be called when there is no previous value.
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config | Object | Properties
|
- Source
object with two function properties, stop
to cancel the repeating request, start
to restart the repeating request, as well as three convenience properties, isPaused
(whether it is currently paused), lastResult
, hasErrored
(whether the last call of the function has errored)
- Type:
- Object
(async) loadConfig(url)
Offer method to load a config file from URL.
Name | Type | Description |
---|---|---|
url | string | URL of config as JSON |
- Source
registryForScheme(scheme, dataTypeopt) → {Object|null}
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
scheme | Object | JSKOS concept scheme object | ||
dataType | string | <optional> | "concepts" | only use providers that support a certain data type (default is "concepts" for backward compatibility) |
- Source
registry object, or null
if determining the registry was not successful
- Type:
- Object |
null
repeat(config) → {Object}
Repeatedly call a certain function.
Notes:
- Callback will only be called if the results were changed.
- The function will only be repeated after the previous call is resolved. This means that the total interval duration is (interval + duration of function call).
Example:
cdk.repeat({
function: () => registry.getMappings(),
callback: (error, result) => console.log(result),
})
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config | Object | Properties
|
- Source
object with two function properties, stop
to cancel the repeating request, start
to restart the repeating request, as well as three convenience properties, isPaused
(whether it is currently paused), lastResult
, hasErrored
(whether the last call of the function has errored)
- Type:
- Object
setConfig(config)
Method to set the configuration.
Name | Type | Description |
---|---|---|
config | Object | Cocoda-stye config object |
- Source
(static) addProvider(provider)
Static method to add custom provider.
Name | Type | Description |
---|---|---|
provider | Object | provider class that extends BaseProvider |
- Source