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

From SmartBots Developers Docs
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
<onlyinclude>Restores a string value from a persistent storage.</onlyinclude> Also check [[/localStorage.set|localStorage.set()]].
+
<onlyinclude>Restores a string value from a persistent storage.</onlyinclude> Also check [[Bot_Playground/Built-in_Functions/localStorage.set|localStorage.set()]].
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Line 11: Line 11:
 
{{API Variable Group|Input}}
 
{{API Variable Group|Input}}
 
{{API Variable|name|yes}} the name of the persistent value you would like to get.
 
{{API Variable|name|yes}} the name of the persistent value you would like to get.
JSON.stringify()
+
 
 +
 
 
{{API Variable Group|Output}}
 
{{API Variable Group|Output}}
{{API Return none}}
+
{{API Variable|value|}} The value you've stored in a persistent storage.
  
 
{{API Variables Table End}}
 
{{API Variables Table End}}

Latest revision as of 14:58, 6 October 2016

Restores a string value from a persistent storage. Also check localStorage.set().

var data = localStorage.get("old_data");

Reference

This command accepts the following parameters:

Variable Required Description


Input:
name yes the name of the persistent value you would like to get.


Output:
value The value you've stored in a persistent storage.

Comments

This function works similar to browser JavaScript localStorage.get(). It retrieves value from a persistent storage.

localStorage is shared by all scripts of the same bot. Thus, you can set values in one bot script and retrieve it in another script.