Module: @accessors-hosts/duktapeHost

An accessor host for small embedded systems that uses the Duktape JavaScript interpreter.

See https://accessors.org/accessors/wiki/Main/DuktapeHost.

Version:
  • $$Id$$
Author:
  • Christopher Brooks
Source:

Members

(inner) accessorPath

Module variable giving the paths to search for accessors. By default this module assumes that accessors are stored in dirname/../.., where dirname is the directory where this script is located.

Source:

Methods

(inner) getAccessorCode(name)

Return the source code for an accessor from its fully qualified name. This will throw an exception if there is no such accessor on the accessor search path.

Parameters:
Name Type Description
name

Fully qualified accessor name, e.g. 'net/REST'.

Source:

(inner) getHostName()

Return the name of this host.

Return the string "Duktape".

Source:
Returns:

In duktapeHost.js, return "Duktape".

(inner) getResource(uri)

Get a resource.

Parameters:
Name Type Description
uri

A specification for the resource.

Source:

(inner) instantiate(accessorName, accessorClass)

Instantiate and return an accessor. This will throw an exception if there is no such accessor class on the accessor search path.

Parameters:
Name Type Description
accessorName

The name to give to the instance.

accessorClass

Fully qualified accessor class name, e.g. 'net/REST'.

Source:

(inner) instantiateAndInitialize(accessorNames)

If there are one or more arguments after duktapeHostInvoke.js, then assume that each argument names a file defining an accessor. Each accessor is instantiated and initialized.

See duktapeHostInvoke.js for a file that requires duktapeHost.js and then invokes this method.

Sample usage:

duktapeHostInvoke.js contains:

var commonHost = require('./duktapeHost.js');
// Remove "node.js" from the array of command line arguments.
process.argv.shift();
// Remove "duktapeHostInvoke.js" from the array of command line arguments.
process.argv.shift();
instantiateAndInitialize(process.argv);

To invoke:

  node duktapeHostInvoke.js test/TestComposite
Parameters:
Name Type Description
accessorNames

An array of accessor names in a format suitable for getAccessorCode(name).

Source: