Commit e9254adc authored by Alexandra Rogova's avatar Alexandra Rogova

custom jio storage

parent 43722c16
......@@ -44,7 +44,6 @@
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.status == 200 && xmlhttp.readyState == 4) return xmlhttp.responseText;
else return null;
}
xmlhttp.open("GET", link, true);
xmlhttp.send();
......
......@@ -5,6 +5,7 @@
<script src="../jio/external/rsvp-2.0.4.js"></script>
<script src="../jio/dist/jio-latest.js"></script>
<script src="../renderjs/dist/renderjs-latest.js"></script>
<script src="jio.my_parser_storage.js"></script>
<script src="jio-parser-test.js"></script>
</head>
<body>
......
......@@ -7,8 +7,9 @@
.ready(function(){
var gadget = this;
gadget.test_storage = jIO.createJIO({
type : "parser",
type : "my_parser",
document_id : "doc_id",
attachment_id :"att_id",
parser : "rss",
......@@ -20,27 +21,22 @@
return gadget.test_storage.put("doc_id", {})
.push (function(){
return gadget.get_test_rss();
})
.push(function(test_rss){
return gadget.test_storage.putAttachment("doc_id", "att_id", new Blob([test_rss]));
})
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.status == 200 && xmlhttp.readyState == 4){
return gadget.test_storage.putAttachment("doc_id", "att_id", new Blob([xmlhttp.responseText], {type: "text/xml"}))
.push(function(){
return gadget.test_storage.get("doc_id");
return gadget.test_storage.get("/0/1");
})
.push(function(result){
console.log("get result : ");
console.log(result);
});
})
.declareMethod("get_test_rss", function(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.status == 200 && xmlhttp.readyState == 4) return xmlhttp.responseText;
else return null;
}
}
xmlhttp.open("GET", "./test-files/vivelessvt.rss", true);
xmlhttp.send();
});
}
});
}(window, RSVP, rJS, jIO));
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