{prop1: {prop2: {prop3: value}}}
. If the nested objects don't exist, they will be created.{prop1: {prop2: {prop3: value}}}
.
|
|
ACtl.var(name,value)
once for each name-value pair, but faster when used on a large amount of variables
since storage is read and written only once.
//Create the `data` variable as an object
await ACtl.var('data', {prop1: 'value 1'}) ;
//Add to it a property `prop2` as a sub object
await ACtl.var('data.prop2.prop3', 'value 2') ;
//Get the value of property `prop1` in that object
let prop1 = await ACtl.var('data.prop1') ;
//Show that value
alert('data.prop1 = ' + prop1 ) ;
//Delete `prop1` from the object
await ACtl.var('data.prop1', null) ;
//Set several variables in one call
await ACtl.var({
variable1: 1.234E5,
variable2: ['1', 2, {3: 'four'}],
variable3: false,
variable4: 'value 4',
}) ;
//Get all existing variables
let allVars = await ACtl.var() ;
//Iterate the name-value pairs in the object
for( let [varName, value] of allVars ){
console.log(varName, value) ;
}