Adding support for "readableBy" and "writableBy" in back

This means that we are now loading maps from server side.
This commit is contained in:
David Négrier 2021-07-19 10:16:43 +02:00
parent 3d76f76d3e
commit dbd5b80636
24 changed files with 768 additions and 132 deletions

View file

@ -26,6 +26,11 @@ export class SharedVariablesManager {
// Let's initialize default values
for (const [name, variableObject] of this.variableObjects.entries()) {
if (variableObject.readableBy && !this.roomConnection.hasTag(variableObject.readableBy)) {
// Do not initialize default value for variables that are not readable
continue;
}
this._variables.set(name, variableObject.defaultValue);
}
@ -35,7 +40,6 @@ export class SharedVariablesManager {
}
roomConnection.onSetVariable((name, value) => {
console.log('Set Variable received from server');
this._variables.set(name, value);
// On server change, let's notify the iframes