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 ecb72d0fd1
commit 89cd292527
5 changed files with 60 additions and 3 deletions

View file

@ -1153,6 +1153,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.