Function Libraries

ICE Data Services -

Function Libraries
Previous  Top 


Function Libraries

EFS2 has the ability to import custom libraries that can extend the language by providing useful utility functions, custom Series objects or custom expressions. All Function Libraries are stored in the FunctionLibraries folder off of the eSignal root (i.e., C:\Program Files\eSignal\FunctionLibrary) and they must be saved with a file extension of ".efsLib".

Function Libraries are simply collections of user-defined functions. There are no special formatting requirements and no required functions in a Function Library, but two functions are automatically called if they do exist:

initLib()

This is called just after the EFS that loaded the library has finished its preMain() sequence and is called in the same context as preMain(). Any items that you wish to happen in preMain() can also be called from initLib().

shutdownLib()

This is called just before the EFS that loaded the library has called its postMain() function.

Function Libraries can be added to any EFS script by calling the addLibrary() function in a global scope.

var myLibrary = addLibrary( "Tools.efsLib" );

Any functions or objects contained in the library can now be called from within the EFS script.

function main() {	var nResult = myLibrary.FunctionName(parameters);		...	...}