Skip to content

Instantly share code, notes, and snippets.

@kixxauth
Created November 19, 2012 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kixxauth/4111848 to your computer and use it in GitHub Desktop.
Save kixxauth/4111848 to your computer and use it in GitHub Desktop.
Backbone.js Single Event Listener Registration
Backbone.Events.one = function (events, callback, context) {
var self = this;
function wrapper() {
self.off(events, wrapper, context);
callback.apply(this, arguments);
}
this.on(events, wrapper, context);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment