Improve state serialization
Change-Id: Ic9d9b791c548827028cbbd4c57751b0c88c8c265
diff --git a/dev/js/src/state/manager.js b/dev/js/src/state/manager.js
index 26cb482..6d7fe11 100644
--- a/dev/js/src/state/manager.js
+++ b/dev/js/src/state/manager.js
@@ -37,13 +37,17 @@
- this._states = JSON.parse(value);
+ this._states = JSON.parse('{' + value + '}');
},
// Return the string representation of all states
toString : function () {
- return JSON.stringify(this._states);
+
+ if (this._states.size === 0)
+ return undefined;
+
+ return JSON.stringify(this._states).slice(1,-1);
},