Use Cases for Server Side Variables

Server-side variables can access all the details of the server-side environment, including the local storage on the virtual machine or any value that is submitted from the client-side to your JENTIS server.

Read and Write Local Storage Properties

With the following server-side variable, you can access an event's property, check the value, and return a result based on it. For this, local storage is very helpful, which can hold information for later use. One example might be a situation where you want to deduplicate transactions that are tracked in your frontend. Sounds interesting? Here is a detailed guide on implementing a server-side deduplication function with server-side variables.

The basic syntax of server-side variables follows this general template:

async function(){
  var storage_value = await this.storage.read("storage_name");
  
  this.storage.write("storage_name", "updated value", Date.now()+94608000000);
}

Server-Side to Client-Side variable references

This feature enables users to access the value of another client-side variable within a client-side variable. As a result, it is possible to reuse values from existing variables. Furthermore, even references of references of references are achievable.

The reference functionality can be used like this:

this.getFrontendVariable("<ID of client-side variable>");

The ID of a variable can be found in the edit view of the JTM in the property field “ID”.\

circle-info

It is important to note that this functionality only works with the JENTIS wrapper scripts we provide.

Full client-side variable example for gathering the screen resolution:

Last updated

Was this helpful?