Octave Edge Action Javascript - custom functions / object prototypes


Is there a way to call custom functions from edge action event handlers for example

Custom function

function appendChecksum(arrayToCheck)
	var checksum = arrayToCheck[0];
	for (var i = 1 ; i < (arrayToCheck.length ) ; i++)
    	checksum = checksum ^ arrayToCheck[i]  ;
    arrayToCheck.push(checksum); // append the checksum

Edge action event handler

function(event) {

    var ex = appendChecksum( [105,110,103,73]);

    return {

        "dh://usp/write": [{"data" : ex}]

I could nest appendChecksum() in the event handler - but then we will have lots of copies of appendChecksum() to maintain.

Ideally I’m looking for some sort of import / export mechanism

Hi John,

While you can code functions in your edge actions, Currently there is no current method to import or include “external” libraries or functions. This idea is a good one and has been requested by several customers and is in the funnel of requested product enhancements.

1 Like