Constructor
new variables()
Methods
add(name, value) → {string}
Add a variable
Example
import {SideeX} from "sideex-api"
var sideex = new SideeX();
console.log(sideex.variables.add("var-0", "hello"));
console.log(sideex.variables.get("vars"));
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of variable |
value |
* | The value of variable |
Returns:
varIdString - The id of variable variables.varIdString
- Type
- string
changeName(varIdString, name) → {object}
Change the name of a variable
Example
import {SideeX} from "sideex-api"
var sideex = new SideeX();
sideex.variables.add("var-0", "hello");
console.log(sideex.variables.changeName("var-0", "var-1"));
console.log(sideex.variables.get("vars"));
Parameters:
Name | Type | Description |
---|---|---|
varIdString |
string | The id of variable |
name |
string | The new name of variable |
Returns:
{varIdString, name}
- Type
- object
changeValue(varIdString, value) → {object}
Change the value of a variable
Example
import {SideeX} from "sideex-api"
var sideex = new SideeX();
sideex.variables.add("var-0", "hello");
console.log(sideex.variables.changeValue("var-0", "hi"));
console.log(sideex.variables.get("vars"));
Parameters:
Name | Type | Description |
---|---|---|
varIdString |
string | The id of variable |
value |
string | The new value of variable |
Returns:
{varIdString, value}
- Type
- object
clearAll()
Delete all variables
Example
import {SideeX} from "sideex-api"
var sideex = new SideeX();
sideex.variables.add();
sideex.variables.add();
sideex.variables.add();
console.log(sideex.variables.get("vars"));
sideex.variables.clearAll();
console.log(sideex.variables.get("vars"));
delete(varIdString) → {string}
Delete a variable by id
Example
import {SideeX} from "sideex-api"
var sideex = new SideeX();
sideex.variables.add();
console.log(sideex.variables.get("vars"));
console.log(sideex.variables.delete("var-0"));
console.log(sideex.variables.get("vars"));
Parameters:
Name | Type | Description |
---|---|---|
varIdString |
string | The id of variable |
Returns:
varIdString - The id of variable
- Type
- string
get(targetopt) → {number|object}
Get the details of variables
Example
import {SideeX} from "sideex-api"
var sideex = new SideeX();
sideex.variables.add();
sideex.variables.add();
sideex.variables.add();
console.log(sideex.variables.get("vars"));
console.log(sideex.variables.get("count"));
console.log(sideex.variables.get("startNum"));
console.log(sideex.variables.get("varNames"));
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
"count" | "startNum" | "varNames" | "vars" |
<optional> |
"vars"
|
The target to get the result |
Returns:
count | vars | varNames | startNum
- Type
- number | object
Type Definitions
count
count
- The count of variables
Type:
- number
startNum
startNum
- The next variable's starting number
Type:
- number
varIdString
varIdString
- The id of variable
Type:
- string
varNames
Properties:
Name | Type | Description |
---|---|---|
varNames.name |
Array.<boolean> | If the name is been created |
varNames
- The name of all variables
Type:
- object
vars
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vars.variableData |
object | Variable's data Properties
|
vars
- All of the variables
Type:
- object