Skip to content

Commit

Permalink
* Initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Mason authored and Seth Mason committed May 8, 2009
0 parents commit 94a9b79
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README
@@ -0,0 +1,26 @@
About
=====
This is an dojo interface to Yahoo's [YQL][yql]. It's heavily based on Dav Glass's
[yui-yql][yui-yql].

To use it:

dojo.yql.execute("SELECT * from friendfeed.feeds WHERE nickname = 'slackorama'",
{ load: function( data ) {
console.dir( data );
},
error: function( e ) {
console.error( e );
}
});


TODO:
=====

* Tests!
* Documentation!
* Profit!

[yql]: http://developer.yahoo.com/yql/
[yui-yql]: http://github.com/davglass/yui-yql/
2 changes: 2 additions & 0 deletions dojox/yql.js
@@ -0,0 +1,2 @@
dojo.provide("dojox.yql");
dojo.require("dojox.yql._base");
48 changes: 48 additions & 0 deletions dojox/yql/_base.js
@@ -0,0 +1,48 @@
dojo.provide("dojox.yql._base");

dojo.require("dojo.io.script");

(function() {
var _d = dojo;
var _dxy = dojox.yql;
var URL = 'http:/' + '/query.yahooapis.com/v1/public/yql';
_dxy.execute = function( qry, ioArgs ) {

if (!ioArgs) {
ioArgs = { };
}
var myArgs = dojo.mixin({},ioArgs );
if (!myArgs.content) {
myArgs.content = { };
}
myArgs.url = URL;
myArgs.callbackParamName = "callback";
myArgs.content.q = qry;
myArgs.content.format = 'json';

if (myArgs.env) {
myArgs.content.env = myArgs.env;
} else {
if (!myArgs.content.env) {
myArgs.content.env = 'http:/' + '/datatables.org/alltables.env';
}
}

// to look into the data to see if there's an error
myArgs.load = function( data ) {
if (data.error) {
if (ioArgs.error) {
ioArgs.error( new Error( data.error.description ) );
return;
}
}
if (data.query) {
if (ioArgs.load) {
ioArgs.load( data.query );
return;
}
}
};
return dojo.io.script.get( myArgs );
};
})();

0 comments on commit 94a9b79

Please sign in to comment.