Commit cbf17acf authored by Ivan Tyagov's avatar Ivan Tyagov

Add sceleton of GadgetCatalog and basic test for it.

parent b23525a0
......@@ -549,6 +549,53 @@ var RenderJs = (function () {
};
}()),
GadgetCatalog : (function () {
/*
* Gadget catalog provides API to get list of gadgets from a repository
*/
return {
updateGadgetIndexFromURL: function (url) {
/*
* Update gadget index from a remote repository.
*/
},
setGadgetIndexUrlList: function (url_list) {
/*
* Set list of Gadget Index repositories.
*/
// store in Cache (html5 storage)
var cache_id = "setGadgetIndexUrlList";
RenderJs.Cache.set(cache_id, url_list)
},
getGadgetIndexUrlList: function () {
/*
* Get list of Gadget Index repositories.
*/
// get from Cache (html5 storage)
var cache_id = "setGadgetIndexUrlList";
return RenderJs.Cache.get(cache_id, undefined)
},
getGadgetListThatProvide: function (service_list) {
/*
* Return list of all gadgets that providen a given service.
* Read this list from data structure created in HTML5 local
* storage by updateGadgetIndexFromURL
*/
// XXX: get from Cache stored index and itterate over it
// to find matching ones
},
registerServiceList: function (gadget, service_list) {
/*
* Register a service provided by a gadget.
*/
},
};
}()),
InteractionGadget : (function () {
/*
* Basic gadget interaction gadget implementation.
......
{"first_name": "John",
"last_name": "Doh"}
\ No newline at end of file
......@@ -164,5 +164,13 @@ function setupRenderJSTest(){
});
});
module("GadgetCatalog");
test('GadgetCatalog', function () {
cleanUp();
var url_list = new Array('gadget_index/gagdet_index.json');
RenderJs.GadgetCatalog.setGadgetIndexUrlList(url_list)
deepEqual(url_list, RenderJs.GadgetCatalog.getGadgetIndexUrlList());
});
};
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