Difference between revisions of "Bot Playground/Built-in Functions"

From SmartBots Developers Docs
Jump to: navigation, search
Line 15: Line 15:
 
{{API_Entry|HTTP Bot Command|Timer control}}
 
{{API_Entry|HTTP Bot Command|Timer control}}
  
{{API_Group|Persistent storage}}
+
{{API_Group|Persistent bot storage}}
 
{{API_Entry|HTTP Bot Command|localStorage.get}}
 
{{API_Entry|HTTP Bot Command|localStorage.get}}
 
{{API_Entry|HTTP Bot Command|localStorage.set}}
 
{{API_Entry|HTTP Bot Command|localStorage.set}}
 +
{{API_Entry|HTTP Bot Command|localStorage.keys}}
 +
{{API_Entry|HTTP Bot Command|localStorage.on}}
  
 
{{API_Group|HTTP}}
 
{{API_Group|HTTP}}

Revision as of 21:37, 14 July 2018

The basic built-in functions do not relate to bot functionality. Instead, they allow writing flexible scripts.

setTimeout(function() { console.log("Timer has fired!"); }, 3000);

Commands reference

Command Description

Program flow

exit Bot Playground/Built-in Functions/exit
sleep Bot Playground/Built-in Functions/sleep
Timer control Standard timer control routines of JavaScript: setTimeout, setInterval etc.

Persistent bot storage

localStorage.get Restores a string value from a persistent storage.
localStorage.set Puts a string value into a persistent storage.
localStorage.keys Returns the list of the available keys in a persistent storage.
localStorage.on Adds the event callback on localStorage.

HTTP

http.get Retrieves data from a HTTP source.
http.post Retrieves data from a HTTP source using the POST method.

Debug

console.log Logs data to the runtime log.
console.error Logs data to the error log.