Commit e9254adc authored by Alexandra Rogova's avatar Alexandra Rogova

custom jio storage

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