Adding support for default variables values
This commit is contained in:
parent
abd53b6251
commit
c30de8c6db
10 changed files with 92 additions and 44 deletions
|
@ -1,11 +1,13 @@
|
|||
WA.onInit().then(() => {
|
||||
console.log('Trying to read variable "doorOpened" whose default property is true. This should display "true".');
|
||||
console.log('doorOpened', WA.room.loadVariable('doorOpened'));
|
||||
|
||||
console.log('Trying to set variable "not_exists". This should display an error in the console.')
|
||||
WA.room.saveVariable('not_exists', 'foo');
|
||||
|
||||
console.log('Trying to set variable "config". This should work.');
|
||||
WA.room.saveVariable('config', {'foo': 'bar'});
|
||||
|
||||
console.log('Trying to read variable "config". This should display a {"foo": "bar"} object.');
|
||||
console.log(WA.room.loadVariable('config'));
|
||||
console.log('Trying to set variable "not_exists". This should display an error in the console.')
|
||||
WA.room.saveVariable('not_exists', 'foo');
|
||||
|
||||
console.log('Trying to set variable "config". This should work.');
|
||||
WA.room.saveVariable('config', {'foo': 'bar'});
|
||||
|
||||
console.log('Trying to read variable "config". This should display a {"foo": "bar"} object.');
|
||||
console.log(WA.room.loadVariable('config'));
|
||||
});
|
||||
|
|
|
@ -72,6 +72,24 @@
|
|||
"template":"config.tx",
|
||||
"x":57.5,
|
||||
"y":111
|
||||
},
|
||||
{
|
||||
"height":0,
|
||||
"id":6,
|
||||
"name":"doorOpened",
|
||||
"point":true,
|
||||
"properties":[
|
||||
{
|
||||
"name":"default",
|
||||
"type":"bool",
|
||||
"value":true
|
||||
}],
|
||||
"rotation":0,
|
||||
"type":"variable",
|
||||
"visible":true,
|
||||
"width":0,
|
||||
"x":131.38069962269,
|
||||
"y":106.004988169086
|
||||
}],
|
||||
"opacity":1,
|
||||
"type":"objectgroup",
|
||||
|
@ -80,7 +98,7 @@
|
|||
"y":0
|
||||
}],
|
||||
"nextlayerid":8,
|
||||
"nextobjectid":6,
|
||||
"nextobjectid":8,
|
||||
"orientation":"orthogonal",
|
||||
"properties":[
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue