Commit dec4d34f authored by Tristan Cavelier's avatar Tristan Cavelier

fix bug from serialized methods: nothing was serialized.

parent 9d7451b2
......@@ -72,7 +72,7 @@ var newLocalStorage = function (spec, my) {
};
// ===================== overrides ======================
that.serialized = function () {
that.specToStore = function () {
return {
"applicationname": priv.applicationname,
"username": priv.username
......
......@@ -17,7 +17,7 @@ jIO.addStorageType('revision', function (spec, my) {
priv.doctree_suffix = ".revision_tree.json";
priv.substorage = spec[priv.substorage_key];
that.serialized = function () {
that.specToStore = function () {
var o = {};
o[priv.substorage_key] = priv.substorage;
return o;
......
......@@ -19,9 +19,8 @@
return '';
};
var super_serialized = that.serialized;
that.serialized = function () {
var o = super_serialized();
that.specToStore = function () {
var o = {};
o.delay = priv.delay;
o.storage = priv.secondstorage_spec;
o.save = priv.save;
......
......@@ -38,11 +38,11 @@ var command = function(spec, my) {
// Methods //
/**
* Returns a serialized version of this command.
* @method super_serialized
* @method serialized
* @return {object} The serialized command.
*/
that.super_serialized = function () {
var o = that.serialized() || {};
that.serialized = function () {
var o = {};
o["label"] = that.getLabel();
o["tried"] = priv.tried;
o["doc"] = that.cloneDoc();
......@@ -50,16 +50,6 @@ var command = function(spec, my) {
return o;
};
/**
* Returns a serialized version of this command.
* Override this function.
* @method serialized
* @return {object} The serialized command.
*/
that.serialized = function() {
return {};
};
/**
* Returns the label of the command.
* @method getLabel
......
......@@ -56,19 +56,20 @@ var storage = function(spec, my) {
* @method serialized
* @return {object} The serialized storage.
*/
that.super_serialized = function() {
var o = that.serialized() || {};
that.serialized = function() {
var o = that.specToStore() || {};
o["type"] = that.getType();
return o;
};
/**
* Returns a serialized version of this storage.
* Returns an object containing spec to store on localStorage, in order to
* be restored later if something wrong happen.
* Override this method!
* @method serialized
* @return {object} The serialized version of this storage
* @method specToStore
* @return {object} The spec to store
*/
that.serialized = function () {
that.specToStore = function () {
return {};
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment