I am trying to use the state manager object in my project, but I notice an unexpected behavior.
First of all, this is my code:
In my sessionConnectedHandler, I have this:
stateManager = session.getStateManager();
stateManager.addEventListener("changed:foo", testStateManagerHandler);
I have another function that does:
stateManager.set("foo", "bar");
And finally:
function testStateManagerHandler(event){
alert("success");
}
The behavior that I'm experiencing is that the testStateManagerHandler is called when I am adding the event listener to the state manager in the sessionConnectedHandler, before I even get to set the new state.
Any thoughts on this? I appreciate your help.