Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Created May 28, 2012 11:50
Show Gist options
  • Select an option

  • Save hughfdjackson/2818750 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/2818750 to your computer and use it in GitHub Desktop.
function loadFunction() {
var obj = {};
Request({
url: "http://0.0.0.0:4567/annotations/" + annotationId,
onComplete: function (response) {
if ( obj.oncomplete ) obj.oncomplete(response);
}
}).get();
return obj;
}
// usage
var promise = loadFunction();
promise.oncomplete = function(response){
console.log(response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment