Hi
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
return(arrayToCheck);
}
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
1 Like
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.
2 Likes
Hi @djudkins do you know if there is anything planned on that topic, namely, the “external libraries” feature in near future?
Our JS edge actions have become very massive, it would have been great to wrap part of their internal functions into a module which then could be reused by all the devices we have.
Thanks.
Hi @alex.clickcatchoff
Unfortunately, there is anything planned on that topic in the near future.
We will keep you posted if this becomes the case.
Thanks,
Nicolas