Store state in LoRa App Server Decode JS function

It would be really nice to have the option to create persistent variables across multiple Decode invocations. Is this possible?

No this isn’t and probably also won’t be possible. The decoder is there to decode your data and should always be deterministic. In case you would like to perform certain actions based on a stored state, then I think it is better to do this in your own endpoint I think.

What would be the use-case for you to support his?

Yes, I understand and I can manage this in the endpoint.

But is it possible to have an additional function along with the Decode that will be invoked in the Decode ? Just to have a cleaner code.

Yes, that is already possible, e.g.:

function Decode(fPort, bytes) {

function foo() {

function bar() {

That is really useful to know.