Virtual Machine

Virtual Machine class:

class Vm(debug=false)

Creates new Virtual Machine

Arguments
  • debug (boolean()) – enables debug info

Vm.A(id)

Get VM actor shortcut

Arguments
  • id (string()) – actor id

Returns

AbstractActor|undefined – actor object or undefined

Vm.M(code)

Get VM Module shortcut

Arguments
  • code (string()) – module code

Returns

AbstractModule|undefined – module object or undefined

Vm.actor(id)

Get VM actor

Arguments
  • id (string()) – actor id

Returns

AbstractActor|undefined – actor object or undefined

Vm.actors()

Get VM actors metadata

Returns

Object – actors metadata map indexed by actor id

Vm.addModule(Module)

Add new module to VM

Arguments
  • Module (AbstractModule()) – module class. should implement Abstract Module interface

Vm.classParents(classCode, library)

Class parents classes

Arguments
  • classCode (string()) – class code

  • library (string()) – class library

Returns

object – class parents. direct and deep extended.

Vm.console(next)

Getter/setter of VM console

Arguments
  • next (Object()) – console object. Should has log, error and debug methods.

Returns

Object – VM console object

Vm.ideData()

Information about VM for IDE

Returns

Object – information object with types, nodes, modules, actors and libraries

Vm.libraries(next)

Getter/setter of VM libraries. Use as setter with care, because as setter - method doesn’t informs modules about update

Arguments
  • next (Object()) – new libraries object.

Returns

Object – VM libraries object

Vm.modules()

VM modules metadata (for IDE)

Returns

Object – modules metadata map indexed by module code

Vm.nodeClass(code)

Node class by node code

Arguments
  • code (string()) – node class code.

Returns

Class – node class

Vm.nodes()

VM nodes metadata (for IDE)

Returns

Array.<Object> – array of registered nodes classes

Vm.registerNode(Class)

Register Node class

Arguments
  • Class (AbstractNode()) – node class. should implement Abstract Node interface

Vm.runFunction(info)

Run Blueprint function from library by info object. Uses runLibraryFunction method.

Arguments
  • info (Object()) – information to run:

  • info.library (string()) – library code where function located

  • info.code (string()) – function code

  • info.inputs (Object()) – function inputs

Returns

any – function result

Vm.runLibraryConstructor(self, lib, fn, inputs)

Run Blueprint class constructor from library by params.

Arguments
  • self (object()) – object to apply constructor

  • lib (string()) – library code where function located

  • fn (string()) – constructor code

  • inputs (Object()) – function inputs

Returns

any – function result

Vm.runLibraryFunction(lib, fn, inputs)

Run Blueprint function from library by params.

Arguments
  • lib (string()) – library code where function located

  • fn (string()) – function code

  • inputs (Object()) – function inputs

Returns

any – function result

Vm.runLibraryMethod(self, lib, fn, inputs)

Run Blueprint class method from library by params.

Arguments
  • self (object()) – object to apply constructor

  • lib (string()) – library code where function located

  • fn (string()) – function code

  • inputs (Object()) – function inputs

Returns

any – function result

Vm.runModuleEvent(info, inputs)

Simple run module event function (without configurstion) from library by info object. Uses runLibraryFunction method. Can be used (when event configuration not exists or doesn’t matter) as simple way to trigger event in modules.

Arguments
  • info (Object()) – information to run:

  • info.library (string()) – library code where event functions located

  • info.module (string()) – module code

  • info.event (string()) – module event code

  • inputs (Object()) – function inputs (event outputs)

Vm.running()

VM is running getter

Returns

boolean – VM running state

Vm.start()

VM start method

Vm.stop()

VM stop method

Vm.types()

Base @bluepjs types (for IDE)

Returns

Object – base types map indexed by type code

Vm.updateLibraries(next)

Setter of VM libraries. Use as main libraries setter, because method do modules update also

Arguments
  • next (Object()) – new libraries object.

Node