@wider/registry

A framework for all $wider bundles but also a tracker for different modules of the same name being loaded by different packages of the same

creates

global.$wider = { 
    // container for other wider globals
}

Classes

loggedError

Methods

inner loaded() → {String}

Generate a report of the items that have been loaded and how long into the run session it was when they are loaded. NB not all loaded items are published.

Returns:
String -

a tabular report of items loaded

inner published() → {String}

A report of the structure in the object that is published via the common object

Returns:
String -

a tabular report of items published

inner register(moduleNameopt, sectionopt, valueopt, objectNameopt) → {Dictionary}

Registers an object typically as it is being constructed via require or import. The purpose being to ensure that multiple packages within your runtime on a given cluster do not load the same module more than once - as can happen when a package is a dependency of several other packages. This function should only only be called from within the module level code of the module that is registering itself

Parameters:
Name Type Attributes Description
moduleName String | Dictionary <optional>

the name of the item to be registered. The string should be the same as used as might be used as id in require or import, or as used in npm install

If moduleName is an object it is treated as a dictionary of registrations where the keyName is the moduleName and the associated value is an object with the properties value and objectName. It may also contain ***section^^^ which if present will override the section parameter of the call to .register()

If moduleName is absent then nothing is registered and the only action is to return the output Dictionary bundle

section NCName <optional>

if absent then the value is saved under objectName at the top level of the output Dictionary, otherwise this defines the section name in the dictionary under which the value is filed

value * <optional>

if present then the moduleName must be supplied and this value is added to the bundle.

If absent, then the moduleName, if provided, is registered in the dictionary and nothing is added to the bundle.

If this is an object (class, function, json, plain object) then it should have a $moduleName static property which is the same as the parameter moduleName.

objectName NCName <optional>

if objectName is present, then value must be supplied and he value is stored in the response of this @wider/registry response under this name available for direct use by any other module without use of requireorimport`. If objectName is not provided then it will be assumed to be the same as moduleName

Throws:

an extension of the javascript `Error`` object. It is thrown when a registration is rejected

Type
loggedError
Returns:
Dictionary -

containing all registered items under their objectname and section.