I'm confused. SharedObject seems have two ways to store value in it, by data and setProperty():
so.data.foo = 'bar';
so.setProperty('boo', 'bar');
What's the different? And why doesn't it have getProperty()?
I'm confused. SharedObject seems have two ways to store value in it, by data and setProperty():
so.data.foo = 'bar';
so.setProperty('boo', 'bar');
What's the different? And why doesn't it have getProperty()?
From the SharedObject
reference: setProperty()
marks a property as "dirty" in addition to setting it, which you need to do if you're using a remote SharedObject
, as it tells the server that the value needs to be updated in other clients.
It's slightly more convenient than manually setting the property and then calling setDirty()
, and there's obviously no need to for a similar getProperty()
method, as the server doesn't need to be informed when you do that.