module:bajaux/registry/Registry

module:bajaux/registry/Registry

Base class for Registry implementations (local JS registration,
agent-based, etc).

Constructor

new (require("bajaux/registry/Registry"))(objopt)

Source:
Since:
  • Niagara 4.10
Parameters:
Name Type Attributes Description
obj Object <optional>

a JSON object to use to initially build this registry
(typically will be used to reconstitute a registry using the previous
output of toJSON). If omitted, registry will be empty on creation.

Methods

getLocal() → {module:bajaux/registry/Registry}

Source:
Returns:
Type
module:bajaux/registry/Registry

queryAll(value, params) → {Promise.<Array.<module:bajaux/registry/RegistryEntry>>}

Description:
  • By default, just queries from the entries registered locally. Most likely,
    subclasses will override this with something more useful.

Source:
Parameters:
Name Type Description
value *
params module:bajaux/registry/Registry~QueryParams
Returns:

promise to be resolved with an array of all matching RegistryEntrys

Type
Promise.<Array.<module:bajaux/registry/RegistryEntry>>

queryFirst(value, params) → {Promise.<module:bajaux/registry/RegistryEntry>}

Description:
  • By default, just queries from the entries registered locally. Most likely,
    subclasses will override this with something more useful.

Source:
Parameters:
Name Type Description
value *
params module:bajaux/registry/Registry~QueryParams
Returns:

promise to be resolved with the first matchingRegistryEntry

Type
Promise.<module:bajaux/registry/RegistryEntry>

register(key, paramsopt) → {Promise}

Description:
  • Register a RequireJS module ID locally for the given key.

Source:
Parameters:
Name Type Attributes Description
key String
params module:bajaux/registry/Registry~QueryParams <optional>

query parameters/metadata for this RequireJS module

Returns:

promise to be resolved after registration is complete

Type
Promise

resolveAll(value, params) → {Promise.<Array.<*>>}

Description:
  • Perform a query on the registry and resolve all RequireJS modules
    represented. This will resolve an array of Widget constructors, menu
    agent functions, etc.

Source:
Parameters:
Name Type Description
value *
params module:bajaux/registry/Registry~QueryParams
Returns:

promise to be resolved with an array of the
exported results of all RequireJS modules represented, or empty if none
found; rejected if the station could not be successfully queried for
registry info, or if any of the RequireJS modules failed to resolve

Type
Promise.<Array.<*>>

resolveFirst(value, params) → {Promise.<*>}

Description:
  • Perform a query on the registry and attempt to resolve the first
    matching entry's RequireJS module. Note that this differs from resolveAll
    in that if the first entry fails to resolve (for instance, an invalid
    RequireJS module ID), it will move on to the next entry and keep trying
    to resolve all the way down until it can resolve something.

Source:
Parameters:
Name Type Description
value *
params module:bajaux/registry/Registry~QueryParams
Returns:

promise to be resolved with the exported
results of the first matching entry that successfully resolves its
RequireJS module ID, or undefined if none found

Type
Promise.<*>

toJSON() → {Object}

Description:
  • Return an object suitable for serialization using JSON.stringify or
    similar. The returned object can be passed right back to a
    Registry constructor to reconstitute later.

Source:
Returns:
Type
Object

Type Definitions

QueryParams

Description:
  • Query parameters to narrow the results resolved for a given registry key.

Source:
Properties:
Name Type Attributes Description
rjs String <optional>

If given, only resolve entries that have this
particular RequireJS ID.

deps Array.<Array.<String>> <optional>

If given, only resolve entries that have
this exact set of RequireJS dependencies.

hasAny Array.<String> <optional>

If given, only resolve entries that
have at least one of these tags.

hasAll Array.<String> <optional>

If given, only resolve entries that
have all of these tags.

Query parameters to narrow the results resolved for a given registry key.

Type:
  • Object