manual:config:items:preprocessing:javascript:javascript_objects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
manual:config:items:preprocessing:javascript:javascript_objects [2021/02/18 08:15]
martins-v fixing typos
manual:config:items:preprocessing:javascript:javascript_objects [2021/03/17 12:30] (current)
martins-v moving global javascript function info (ZBX-18592)
Line 3: Line 3:
 === Overview === === Overview ===
  
-This section describes Zabbix additions to the JavaScript language implemented with Duktape.+This section describes Zabbix additions to the JavaScript language implemented with Duktape ​and supported global JavaScript functions.
  
 === Built-in objects === === Built-in objects ===
Line 77: Line 77:
 return JSON.stringify(result);​ return JSON.stringify(result);​
 </​code>​ </​code>​
 +
 +=== Global JavaScript functions ===
 +
 +Additional global JavaScript functions have been implemented with Duktape:
 +
 +  * btoa(string) - encodes string to base64 string
 +  * atob(base64_string) - decodes base64 string
 +
 +<code java>
 +try {
 +    b64 = btoa("​utf8 string"​);​
 +    utf8 = atob(b64);
 +
 +catch (error) {
 +    return {'​error.name'​ : error.name, '​error.message'​ : error.message}
 +}
 +</​code>​
 +
 +  * md5(string) - calculates the MD5 hash of a string. This function is supported since Zabbix 5.2.5
 +  * sha256(string) - calculates the SHA256 hash of a string. This function is supported since Zabbix 5.2.5