Skip to content

Instantly share code, notes, and snippets.

@jcleblanc
Created September 3, 2010 00:40
Show Gist options
  • Save jcleblanc/563201 to your computer and use it in GitHub Desktop.
Save jcleblanc/563201 to your computer and use it in GitHub Desktop.
return {
//push widget on the load stack
push: function(query, config, format, insertEl){
//validate widget variables
if (query == null || format == null || insertEl == null){
if (setupConfig["debug"] && window.console){ console.log("Missing query, return format or insert element"); }
return null;
}
//push widget load on the stack
widgetStack.push(function(){
yqlWidget.init(query, config, format, insertEl);
});
},
//pop widget off the load stack and execute
render: function(){
if (widgetStack.length > 0){ widgetStack.pop()(); }
},
//widget initialization
init: function(query, config, format, insertEl){
resultFormat = format;
queryInsert = insertEl;
if (config){ setupConfig = config; }
return getYQLData(query);
},
//yql data caption success callback
getYQLDataCallback: function(o){
if (! o.query){
if (setupConfig["debug"] && window.console){ console.log("YQL query returned no results"); }
return null;
}
parseYQLResults(o.query.results);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment