Recent Changes - Search:

edit SideBar

Instantiate

An accessor may instantiate any number of contained accessors in the body of its setup() function using

  • instantiate(<string> instanceName, <string> className]): Instantiate an accessor of specified class and assign it the specified name (which is used for reporting errors).

For example:

 exports.setup = function() {
     this.instantiate('test', 'test/TestAccessor');
 }

The instantiate() function takes two arguments, both strings. The instanceName should be unique for each instance of a contained accessor.

The className should be a fully qualified accessor class name, e.g. 'net/REST'. The swarmlet host will search for this accessor in its accessor library (current hosts use the TerraSwarm accessor library.

The instantiate function returns an accessor instance that can be used as an argument to the connect function.


Back to Accessor Specification

Edit - History - Print - Recent Changes - Search
Page last modified on January 30, 2016, at 01:45 AM