Skip to content

Instantly share code, notes, and snippets.

@alexandernst
Created July 18, 2012 08:07
Show Gist options
  • Save alexandernst/3134948 to your computer and use it in GitHub Desktop.
Save alexandernst/3134948 to your computer and use it in GitHub Desktop.
Backbone View listening for finished uploads
var myView = Backbone.View.extend({
events: {
'click .start_upload': 'start_upload'
}
initialize: function(){
EventBus.addEventListener("upload_done", this.upload_callback);
}
start_upload: function(){
// form.submit() ...
// more stuff ...
}
upload_callback: function(event, id){
console.log("Upload finished. ID ", id, " was returned.");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment