Allows to read and write "Player properties" from LocalStorage

This commit is contained in:
Benedicte Quimbert 2021-10-15 17:01:38 +02:00
parent 68431c5242
commit e025c1dc8e
5 changed files with 59 additions and 2 deletions

View file

@ -1223,6 +1223,19 @@ ${escapedMessage}
};
});
//TODO : move Player Properties related-code
iframeListener.registerAnswerer("setPlayerProperty", (event) => {
localUserStore.setUserProperty(event.propertyName, event.propertyValue as string);
});
iframeListener.registerAnswerer("getPlayerProperty", (event) => {
return {
propertyName: event,
propertyValue: localUserStore.getUserProperty(event),
};
});
//END TODO
iframeListener.registerAnswerer("getState", async () => {
// The sharedVariablesManager is not instantiated before the connection is established. So we need to wait
// for the connection to send back the answer.