datasource-offlinecache-source.mustache revision 72378c4b11f0468874fbad14749246d2ae564474
6964N/A<form id="demo" action="http://search.yahoo.com/search">
<script type="text/javascript">
YUI().use("json-stringify","node", "datasource-get", "datasource-jsonschema", "cache", "datasource-cache", "datatype-date", function (Y) {
var output = Y.one("#demo_output_response"),
myDataSource = new Y.DataSource.Get({
source:"https://api.github.com/users/",
return '/repos?callback=YUI.Env.DataSource.callbacks.' + guid;
var when = Y.DataType.Date.format(new Date(), {format:"%F %r"}),
data.replace(/&/g,"&")
var when = Y.DataType.Date.format(new Date(), {format:"%F %r"}),
message = /fields retrieval/.test(e.error.message) ?
"User not found" : e.error.message;
cache: Y.CacheOffline,
myDataSource.cache.on("retrieve", function(){
Y.one("#demo_cache_clear").on("click", function(){
var when = Y.DataType.Date.format(new Date(), {format:"%F %r"});
output.setContent("<p>[" + when + "] Cache cleared.</p>");
Y.on("submit", function(e){
e.halt();
Y.one("#demo_input_query")
output.setContent("<p>Please enter a query.</p>");