The Javascript API documentation provides a object reference, code examples and more for the Motive Database Client.
Global objects or functions can be accessed without creating with the new
operator (e.g. Globals
). Global functions can be called directly without an object (e.g., print()
, see GlobalScope for reference). Library functions are functions that actually look and behave like global functions, but are defined in a javascript file. The example illustrates the various types of global objects:
function testGlobalThings() { // this is a global function: var id = simulationrun(5); // global function 'print' accessing the global object 'Globals': // Globals is object of type "Globals" print(Globals.simulationRunId); // creating an object explicitely with the new operator: var ds = new DataSource; // calling the library function loadTable() that creates a "DataSource" object: var ds2 = loadTable('myfile.txt'); // --> ds and ds2 are both objects of type "DataSource" }
written by werner rammer, petr kneblik