trying to figure out async testing
Showing
... | @@ -8392,6 +8392,10 @@ return new Parser; | ... | @@ -8392,6 +8392,10 @@ return new Parser; |
}); | }); | ||
}; | }; | ||
JioProxyStorage.prototype.list = function () { | |||
return this.__storage.list.apply(this.__storage, arguments); | |||
}; | |||
declareMethod(JioProxyStorage, 'putAttachment', function (argument_list, | declareMethod(JioProxyStorage, 'putAttachment', function (argument_list, | ||
storage, | storage, | ||
method_name) { | method_name) { | ||
... | @@ -16388,3 +16392,52 @@ return new Parser; | ... | @@ -16388,3 +16392,52 @@ return new Parser; |
jIO.addStorage("nocapacity", NoCapacityStorage); | jIO.addStorage("nocapacity", NoCapacityStorage); | ||
}(jIO)); | }(jIO)); | ||
/*global define, jIO */ | |||
/*jslint nomen: true*/ | |||
(function (jIO) { | |||
"use strict"; | |||
function randomId() { | |||
// https://gist.github.com/gordonbrander/2230317 | |||
return '_' + Math.random().toString(36).substr(2, 9); | |||
} | |||
function ListStorage(spec) { | |||
this._sub_storage = jIO.createJIO(spec.sub_storage); | |||
this._signature_storage = jIO.createJIO({ | |||
"type": "indexeddb", | |||
"database": randomId() | |||
}); | |||
this._signature_storage.post("_", { | |||
list: [] | |||
}); | |||
} | |||
ListStorage.prototype.post = function () { | |||
console.log('alright alright alright alright alright ok now ladies'); | |||
var id = this._sub_storage.post.apply(this._sub_storage, arguments), | |||
|
|||
updated_list = this._signature_storage.get("_").list.concat(id); | |||
this._signature_storage.put("_", {list: updated_list}); | |||
}; | |||
ListStorage.prototype.get = function () { | |||
return this._sub_storage.get.apply(this._sub_storage, arguments); | |||
}; | |||
ListStorage.prototype.put = function () { | |||
return this._sub_storage.put.apply(this._sub_storage, arguments); | |||
}; | |||
ListStorage.prototype.remove = function (id) { | |||
var updated_list = this._signature_storage.get("_") | |||
.list.filter(function (x) { return x !== id; }); | |||
this._signature_storage.put("_", { list: updated_list }); | |||
}; | |||
ListStorage.prototype.list = function () { | |||
return this._sub_storage.get("_").list; | |||
}; | |||
jIO.addStorage("list", ListStorage); | |||
}(jIO)); |