Class: GeneralDynamic

base.GeneralDynamic()

This class provide a basic interface for carrying out actions required for providing dynamic content. Here Dynamic Content is taken to mean content that is created by the application in repsonse to a query.

NOTE: all the base classes in /lib return the class and do not return an instance. Explore the applications and the reader will find that the descendant modules export instances. The classes provided by copious-transitions must be extended by an application.

Constructor

new GeneralDynamic()

Source:

Methods

add_import(key, uses, setter_fn)

May be called to set up a list of functions that may be used in an importer function.

Parameters:
Name Type Description
key string
uses Array
setter_fn function
Source:

fetch(asset, trans_object) → {object}

This method looks for the dynamic asset and may request that some view of it be constructed in response to the request that results in a call to this method.

This is called by mime processing.

Parameters:
Name Type Description
asset string
trans_object object
Source:
Returns:
Type
object

fetch_elements(asset, trans_object) → {Array}

This method looks for the dynamic asset and may request that some view of it be constructed in response to the request that results in a call to this method.

This is called by transition processing.

Transition processing may require some data to be stored between the primary and secondary action (request). This method will produce stored elements and sent elements.

Parameters:
Name Type Description
asset string
trans_object object
Source:
Returns:

This array has two elements. The first elements is the data to be sent to the client, the second are elements that are to be cached for a secondary action.

Type
Array

import_keys(importer_fn)

Called by the general transition engine. The general transition engine supplies a function to import_keys that uses a key and uses (an array or map) from each key setter, a descriptor to create a key to use in the setter function.

The keys and uses are related to cryptographic applications

Each key setter descriptor will have three fields:

  • key - some type of crypto key (each an elliptic key for derivation)
  • setter_fn - a function that takes the key created by the imported function
  • uses - an array of string or descriptors (objects) indicating the function of the key, e.g. signage or verification

The key and the uses are passed to the importer function which produce a key, (a descriptive string) The setter, from the imported_key_setters element, is then called.

Parameters:
Name Type Description
importer_fn function
Source:

initialize(db)

This initializer does no more than set the connection to the database.

Parameters:
Name Type Description
db object
Source:

(async) load_key(key_location, cb) → {string}

Parameters:
Name Type Description
key_location string
cb function
Source:
Returns:
Type
string

set_transition_engine(transition_engine)

Parameters:
Name Type Description
transition_engine object

a connect to the transition engine

Source: